summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorSzabolcs Sipos <szabolcs.sipos@ericsson.com>2015-05-22 11:35:50 +0000
committerSzabolcs Sipos <szabolcs.sipos@ericsson.com>2015-05-22 11:35:50 +0000
commitb37b0ed239f51932b3c58d03f12b7f213a99cf1b (patch)
treeef110c4a9b47302d7cb297a29d1f486225e060f7 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parent575f7d4f1c1e1d818103e8b6b2c8d69c1f08836f (diff)
downloadbcm5719-llvm-b37b0ed239f51932b3c58d03f12b7f213a99cf1b.tar.gz
bcm5719-llvm-b37b0ed239f51932b3c58d03f12b7f213a99cf1b.zip
Adding new AST matcher: isConstexpr
It matches constexpr variable and function declarations. llvm-svn: 238016
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 6f1cf3fe2c8..ae363e974b5 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1595,6 +1595,13 @@ TEST(IsDeleted, MatchesDeletedFunctionDeclarations) {
functionDecl(hasName("Func"), isDeleted())));
}
+TEST(isConstexpr, MatchesConstexprDeclarations) {
+ EXPECT_TRUE(matches("constexpr int foo = 42;",
+ varDecl(hasName("foo"), isConstexpr())));
+ EXPECT_TRUE(matches("constexpr int bar();",
+ functionDecl(hasName("bar"), isConstexpr())));
+}
+
TEST(HasAnyParameter, DoesntMatchIfInnerMatcherDoesntMatch) {
EXPECT_TRUE(notMatches("class Y {}; class X { void x(int) {} };",
methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
OpenPOWER on IntegriCloud