v8toolkit  0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
ast_consumer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "clang.h"
4 
5 #include "class_handler.h"
6 
7 
8 /**
9  * Defines what will be matched and sent to
10  */
11 class MyASTConsumer : public ASTConsumer {
12 private:
13 
14  // matcher that is parameterized in constructor
15  ast_matchers::MatchFinder Matcher;
16 
17  // MatchCallback object called for each element matched by matcher
18  ClassHandler HandlerForClass;
19 
20  CompilerInstance & ci;
21 
22 public:
23  MyASTConsumer(CompilerInstance &CI);
24 
25  void HandleTranslationUnit(ASTContext &Context) override {
26  // Run the matchers when we have the whole TU parsed.
27  // matchers configured in constructor
28  Matcher.matchAST(Context);
29  }
30 
31 
32 };
MyASTConsumer(CompilerInstance &CI)
Definition: ast_consumer.cpp:7
void HandleTranslationUnit(ASTContext &Context) override
Definition: ast_consumer.h:25