diff options
author | Manuel Klimek <klimek@google.com> | 2012-10-24 14:47:44 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2012-10-24 14:47:44 +0000 |
commit | 3e2aa99e992b89bd421ac2a6bf79307114d257fc (patch) | |
tree | 3e4707ed91c371667f38b5b14b2a6a05e36d14d5 /lib/ASTMatchers | |
parent | 403f2c68046eba1a9d5e3f7b52b8481573e56d40 (diff) |
Adds the possibility to run ASTMatchFinder over arbitrary AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ASTMatchers')
-rw-r--r-- | lib/ASTMatchers/ASTMatchFinder.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index c0d97df075..218b78187d 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -667,6 +667,18 @@ ASTConsumer *MatchFinder::newASTConsumer() { return new internal::MatchASTConsumer(&MatcherCallbackPairs, ParsingDone); } +void MatchFinder::findAll(const Decl &Node, ASTContext &Context) { + internal::MatchASTVisitor Visitor(&MatcherCallbackPairs); + Visitor.set_active_ast_context(&Context); + Visitor.TraverseDecl(const_cast<Decl*>(&Node)); +} + +void MatchFinder::findAll(const Stmt &Node, ASTContext &Context) { + internal::MatchASTVisitor Visitor(&MatcherCallbackPairs); + Visitor.set_active_ast_context(&Context); + Visitor.TraverseStmt(const_cast<Stmt*>(&Node)); +} + void MatchFinder::registerTestCallbackAfterParsing( MatchFinder::ParsingDoneTestCallback *NewParsingDone) { ParsingDone = NewParsingDone; |