summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-01-18 20:28:57 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-01-18 20:28:57 +0000
commitd7b18b9f2ff8077e87468a09df3a8f72eeb929d9 (patch)
tree9e319ea2decc7ebced0cf80f69f11b9647a3b907 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parentf312d89f506b2207694e405224496143f74721a0 (diff)
downloadbcm5719-llvm-d7b18b9f2ff8077e87468a09df3a8f72eeb929d9.tar.gz
bcm5719-llvm-d7b18b9f2ff8077e87468a09df3a8f72eeb929d9.zip
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
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 46392dcd63a..c76100a433c 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1616,9 +1616,9 @@ TEST(ForEachArgumentWithParam, ReportsNoFalsePositives) {
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 @@ TEST(ForEachArgumentWithParam, MatchesCXXMemberCallExpr) {
" 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) {
OpenPOWER on IntegriCloud