Augments r258042; changes the AST matcher tests to use matchesNot and EXPECT_TRUE instead of EXPECT_FALSE. Adds a matcher test to ensure that static member functions are properly handled. Generates the documentation from the matcher.
llvm-svn: 258070
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 46392dc..c76100a 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1616,9 +1616,9 @@
callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
// IntParam does not match.
- EXPECT_FALSE(matches("void f(int* i) { int* y; f(y); }", CallExpr));
+ EXPECT_TRUE(notMatches("void f(int* i) { int* y; f(y); }", CallExpr));
// ArgumentY does not match.
- EXPECT_FALSE(matches("void f(int i) { int x; f(x); }", CallExpr));
+ EXPECT_TRUE(notMatches("void f(int i) { int x; f(x); }", CallExpr));
}
TEST(ForEachArgumentWithParam, MatchesCXXMemberCallExpr) {
@@ -1636,6 +1636,18 @@
" S1[y];"
"}",
CallExpr, new VerifyIdIsBoundTo<ParmVarDecl>("param", 1)));
+
+ StatementMatcher CallExpr2 =
+ callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
+ EXPECT_TRUE(matchAndVerifyResultTrue(
+ "struct S {"
+ " static void g(int i);"
+ "};"
+ "void f() {"
+ " int y = 1;"
+ " S::g(y);"
+ "}",
+ CallExpr2, new VerifyIdIsBoundTo<ParmVarDecl>("param", 1)));
}
TEST(ForEachArgumentWithParam, MatchesCallExpr) {