summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-11-07 22:30:36 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-11-07 22:30:36 +0000
commita2334162cffc91f31898f79b0a286474e8365ce9 (patch)
treeb6663a0327d0ff955c358b05942453eae9a14559 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parent2b94713053aef3ca42e4e555ed6e04e41215762d (diff)
downloadbcm5719-llvm-a2334162cffc91f31898f79b0a286474e8365ce9.tar.gz
bcm5719-llvm-a2334162cffc91f31898f79b0a286474e8365ce9.zip
Introduce MatchFinder::matchAST.
Differential Revision: http://llvm-reviews.chandlerc.com/D2115 llvm-svn: 194223
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 5649ad897e8..cc13c01fec3 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4114,6 +4114,12 @@ TEST(MatchFinder, InterceptsStartOfTranslationUnit) {
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
ASSERT_TRUE(tooling::runToolOnCode(Factory->create(), "int x;"));
EXPECT_TRUE(VerifyCallback.Called);
+
+ VerifyCallback.Called = false;
+ OwningPtr<ASTUnit> AST(tooling::buildASTFromCode("int x;"));
+ ASSERT_TRUE(AST.get());
+ Finder.matchAST(AST->getASTContext());
+ EXPECT_TRUE(VerifyCallback.Called);
}
class VerifyEndOfTranslationUnit : public MatchFinder::MatchCallback {
@@ -4135,6 +4141,12 @@ TEST(MatchFinder, InterceptsEndOfTranslationUnit) {
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
ASSERT_TRUE(tooling::runToolOnCode(Factory->create(), "int x;"));
EXPECT_TRUE(VerifyCallback.Called);
+
+ VerifyCallback.Called = false;
+ OwningPtr<ASTUnit> AST(tooling::buildASTFromCode("int x;"));
+ ASSERT_TRUE(AST.get());
+ Finder.matchAST(AST->getASTContext());
+ EXPECT_TRUE(VerifyCallback.Called);
}
TEST(EqualsBoundNodeMatcher, QualType) {
OpenPOWER on IntegriCloud