aboutsummaryrefslogtreecommitdiff
path: root/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorEdwin Vane <edwin.vane@intel.com>2013-02-12 13:55:40 +0000
committerEdwin Vane <edwin.vane@intel.com>2013-02-12 13:55:40 +0000
commit7f43fcf5d9406788ce95c9f3b785e0a6bc75a7f7 (patch)
tree48c14e528419b5dd8aa56fd251cdb764655de569 /unittests/ASTMatchers/ASTMatchersTest.cpp
parent6c9dccd7c437d091a911b749eb0b96f7baea7715 (diff)
Adding more overloads for allOf matcher
Adding overloads of allOf accepting 4 and 5 arguments. Reviewer: klimek git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index 618ac6ec51..129f90f2dc 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -351,7 +351,9 @@ TEST(ClassTemplate, DoesNotMatchClassTemplatePartialSpecialization) {
TEST(AllOf, AllOverloadsWork) {
const char Program[] =
- "struct T { }; int f(int, T*); void g(int x) { T t; f(x, &t); }";
+ "struct T { };"
+ "int f(int, T*, int, int);"
+ "void g(int x) { T t; f(x, &t, 3, 4); }";
EXPECT_TRUE(matches(Program,
callExpr(allOf(callee(functionDecl(hasName("f"))),
hasArgument(0, declRefExpr(to(varDecl())))))));
@@ -360,6 +362,19 @@ TEST(AllOf, AllOverloadsWork) {
hasArgument(0, declRefExpr(to(varDecl()))),
hasArgument(1, hasType(pointsTo(
recordDecl(hasName("T")))))))));
+ EXPECT_TRUE(matches(Program,
+ callExpr(allOf(callee(functionDecl(hasName("f"))),
+ hasArgument(0, declRefExpr(to(varDecl()))),
+ hasArgument(1, hasType(pointsTo(
+ recordDecl(hasName("T"))))),
+ hasArgument(2, integerLiteral(equals(3)))))));
+ EXPECT_TRUE(matches(Program,
+ callExpr(allOf(callee(functionDecl(hasName("f"))),
+ hasArgument(0, declRefExpr(to(varDecl()))),
+ hasArgument(1, hasType(pointsTo(
+ recordDecl(hasName("T"))))),
+ hasArgument(2, integerLiteral(equals(3))),
+ hasArgument(3, integerLiteral(equals(4)))))));
}
TEST(DeclarationMatcher, MatchAnyOf) {