Introduce MatchFinder::matchAST.

Differential Revision: http://llvm-reviews.chandlerc.com/D2115

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194223 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index 5649ad8..cc13c01 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4114,6 +4114,12 @@
   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 @@
   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) {