diff options
Diffstat (limited to 'goatc.hh')
-rw-r--r-- | goatc.hh | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/goatc.hh b/goatc.hh index 76e1525..5eed297 100644 --- a/goatc.hh +++ b/goatc.hh @@ -19,37 +19,42 @@ #include <clang/AST/RecursiveASTVisitor.h> #include <clang/Frontend/FrontendPluginRegistry.h> -class GoatCVisitor : public clang::RecursiveASTVisitor<GoatCVisitor> { - clang::ASTContext* ctx; +namespace goatc +{ + class Visitor : public clang::RecursiveASTVisitor <Visitor> { + clang::ASTContext* ctx; -public: - GoatCVisitor(clang::ASTContext* ctx) : ctx {ctx} - { } -}; + public: + Visitor(clang::ASTContext* ctx) : ctx {ctx} + { } -class GoatCConsumer : public clang::ASTConsumer { - clang::CompilerInstance& ci; - /// Consuming source file that is not patched - bool noop; + bool VisitDecl (clang::Decl*); + }; - bool HandleTopLevelDecl (clang::DeclGroupRef) override; + class Consumer : public clang::ASTConsumer { + Visitor visitor; + /// Consuming source file that is not patched + bool noop; -public: - GoatCConsumer (clang::CompilerInstance& ci, bool noop) : ci {ci}, noop {noop} - { } -}; + void HandleTranslationUnit (clang::ASTContext&) override; -class GoatCAction : public clang::PluginASTAction { - std::string source_file; + public: + Consumer (clang::ASTContext* ctx, bool noop) : visitor {ctx}, noop {noop} + { } + }; - std::unique_ptr <clang::ASTConsumer> CreateASTConsumer - (clang::CompilerInstance&, llvm::StringRef) override; + class Action : public clang::PluginASTAction { + std::string source_file; - bool ParseArgs (const clang::CompilerInstance&, - const std::vector <std::string>&) override; + std::unique_ptr <clang::ASTConsumer> CreateASTConsumer + (clang::CompilerInstance&, llvm::StringRef) override; - clang::PluginASTAction::ActionType getActionType () override; -}; + bool ParseArgs (const clang::CompilerInstance&, + const std::vector <std::string>&) override; -static clang::FrontendPluginRegistry::Add <GoatCAction> + clang::PluginASTAction::ActionType getActionType () override; + }; +} // namespace goatc + +static clang::FrontendPluginRegistry::Add <goatc::Action> X {"goatc", "chimera breeder"}; |