diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-07 22:11:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-07 22:11:34 +0000 |
commit | e0c5497935bfbca456d3070b1d9ec66faecb9461 (patch) | |
tree | ebe79dba8b0091fb9a5e60ba35e1442f9d2fe5b1 /clang/lib/Frontend/BoostConAction.cpp | |
parent | b1fb0d3610d70b8a3a849b8652d5b46a9d1ce8fb (diff) | |
download | bcm5719-llvm-e0c5497935bfbca456d3070b1d9ec66faecb9461.tar.gz bcm5719-llvm-e0c5497935bfbca456d3070b1d9ec66faecb9461.zip |
Introduce a recursive AST visitor that makes it trivial to recursively
walk an entire AST, including all of the types, declarations,
statements, and expressions, and allowing one to easily override the
behavior of the walk at any particular node kind.
llvm-svn: 103308
Diffstat (limited to 'clang/lib/Frontend/BoostConAction.cpp')
-rw-r--r-- | clang/lib/Frontend/BoostConAction.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Frontend/BoostConAction.cpp b/clang/lib/Frontend/BoostConAction.cpp index 505d5afe3e7..6995969fdf9 100644 --- a/clang/lib/Frontend/BoostConAction.cpp +++ b/clang/lib/Frontend/BoostConAction.cpp @@ -8,11 +8,13 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/FrontendActions.h" #include "clang/AST/ASTConsumer.h" +#include "clang/AST/RecursiveASTVisitor.h" #include <cstdio> using namespace clang; namespace { - class BoostConASTConsumer : public ASTConsumer { + class BoostConASTConsumer : public ASTConsumer, + public RecursiveASTVisitor<BoostConASTConsumer> { public: /// HandleTranslationUnit - This method is called when the ASTs for entire /// translation unit have been parsed. @@ -27,4 +29,5 @@ ASTConsumer *BoostConAction::CreateASTConsumer(CompilerInstance &CI, void BoostConASTConsumer::HandleTranslationUnit(ASTContext &Ctx) { fprintf(stderr, "Welcome to BoostCon!\n"); + Visit(Ctx.getTranslationUnitDecl()); } |