summaryrefslogtreecommitdiffstats
path: root/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2016-10-31 22:04:07 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2016-10-31 22:04:07 +0000
commitcc21152c21d1ba222e796b904eab8640e720df3c (patch)
tree606fe0f5db96df669f4d07b39752d4e0a269493b /unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
parent2a210ccdfe2933df58096e10e94d6faa6e0585e6 (diff)
[ASTMatcher] Add CXXNewExpr support to hasDeclaration
Reviewers: sbenza, lukasza, aaron.ballman, klimek Subscribers: lukasza, sbenza, cfe-commits Differential Revision: https://reviews.llvm.org/D26032 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTraversalTest.cpp')
-rw-r--r--unittests/ASTMatchers/ASTMatchersTraversalTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index ff45fe6c51..08940b7e03 100644
--- a/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -241,6 +241,12 @@ TEST(HasDeclaration, HasDeclarationOfTemplateSpecializationType) {
hasDeclaration(namedDecl(hasName("A"))))))));
}
+TEST(HasDeclaration, HasDeclarationOfCXXNewExpr) {
+ EXPECT_TRUE(
+ matches("int *A = new int();",
+ cxxNewExpr(hasDeclaration(functionDecl(parameterCountIs(1))))));
+}
+
TEST(HasUnderlyingDecl, Matches) {
EXPECT_TRUE(matches("namespace N { template <class T> void f(T t); }"
"template <class T> void g() { using N::f; f(T()); }",