diff options
author | Daniel Jasper <djasper@google.com> | 2012-12-04 11:54:27 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2012-12-04 11:54:27 +0000 |
commit | 9f501295bdfdd28ca9c3dd811c693b442af6d3b1 (patch) | |
tree | b7ad7173f9bb522a114975d1bb200a168c535e16 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | 64bc1ab3498634a1f8d82529d759eebd2901a571 (diff) | |
download | bcm5719-llvm-9f501295bdfdd28ca9c3dd811c693b442af6d3b1.tar.gz bcm5719-llvm-9f501295bdfdd28ca9c3dd811c693b442af6d3b1.zip |
Add parameterCountIs() matcher.
llvm-svn: 169257
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index ad072aa7ce3..f3d377b771f 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -1238,6 +1238,14 @@ TEST(Matcher, ArgumentCount) { EXPECT_TRUE(notMatches("void x(int, int) { x(0, 0); }", Call1Arg)); } +TEST(Matcher, ParameterCount) { + DeclarationMatcher Function1Arg = functionDecl(parameterCountIs(1)); + EXPECT_TRUE(matches("void f(int i) {}", Function1Arg)); + EXPECT_TRUE(matches("class X { void f(int i) {} };", Function1Arg)); + EXPECT_TRUE(notMatches("void f() {}", Function1Arg)); + EXPECT_TRUE(notMatches("void f(int i, int j, int k) {}", Function1Arg)); +} + TEST(Matcher, References) { DeclarationMatcher ReferenceClassX = varDecl( hasType(references(recordDecl(hasName("X"))))); |