-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
521deec
commit 21abfca
Showing
7 changed files
with
135 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// | ||
// Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// Copyright (c) 2023 Vinnie Falco ([email protected]) | ||
// | ||
// Official repository: https://github.com/cppalliance/mrdox | ||
// | ||
|
||
#ifndef MRDOX_TEST_TEST_VISITOR_HPP | ||
#define MRDOX_TEST_TEST_VISITOR_HPP | ||
|
||
#include <mrdox/BasicVisitor.hpp> | ||
#include <clang/Tooling/Execution.h> | ||
|
||
namespace clang { | ||
namespace mrdox { | ||
|
||
//------------------------------------------------ | ||
|
||
/** A Visitor which stores tool results in a local map | ||
*/ | ||
struct TestVisitor : public BasicVisitor | ||
{ | ||
explicit | ||
TestVisitor( | ||
Config const& cfg) noexcept | ||
: BasicVisitor(cfg) | ||
{ | ||
} | ||
|
||
private: | ||
void | ||
reportResult( | ||
llvm::StringRef Key, | ||
llvm::StringRef Value) override | ||
{ | ||
results_.addResult(Key, Value); | ||
} | ||
|
||
tooling::InMemoryToolResults results_; | ||
}; | ||
|
||
//------------------------------------------------ | ||
|
||
struct TestAction | ||
: public clang::ASTFrontendAction | ||
{ | ||
explicit | ||
TestAction( | ||
Config const& cfg) noexcept | ||
: cfg_(cfg) | ||
{ | ||
} | ||
|
||
std::unique_ptr<clang::ASTConsumer> | ||
CreateASTConsumer( | ||
clang::CompilerInstance& Compiler, | ||
llvm::StringRef InFile) override | ||
{ | ||
return std::make_unique<TestVisitor>(cfg_); | ||
} | ||
|
||
private: | ||
Config const& cfg_; | ||
}; | ||
|
||
//------------------------------------------------ | ||
|
||
struct TestFactory | ||
: public tooling::FrontendActionFactory | ||
{ | ||
explicit | ||
TestFactory( | ||
Config const& cfg) noexcept | ||
: cfg_(cfg) | ||
{ | ||
} | ||
|
||
std::unique_ptr<FrontendAction> | ||
create() override | ||
{ | ||
return std::make_unique<TestAction>(cfg_); | ||
} | ||
|
||
private: | ||
Config const& cfg_; | ||
}; | ||
|
||
} // mrdox | ||
} // clang | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.