summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2014-04-02 13:12:14 +0000
committerSamuel Benzaquen <sbenza@google.com>2014-04-02 13:12:14 +0000
commitf10662923aabd7066085c424f655209da78a15fc (patch)
tree837bbb830e238ae0c774deeaabff9bcece59827e /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parent2019cea863edd12df1a95ba1cddefcdc91b3c576 (diff)
downloadbcm5719-llvm-f10662923aabd7066085c424f655209da78a15fc.tar.gz
bcm5719-llvm-f10662923aabd7066085c424f655209da78a15fc.zip
Add matcher for ExprWithCleanups.
Summary: Add matcher for ExprWithCleanups. Reviewers: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3248 llvm-svn: 205420
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 05b07c81a9f..5d09700e6e0 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2943,6 +2943,15 @@ TEST(DeclarationStatement, MatchesVariableDeclarationStatements) {
EXPECT_TRUE(matches("void x() { int a; }", declStmt()));
}
+TEST(ExprWithCleanups, MatchesExprWithCleanups) {
+ EXPECT_TRUE(matches("struct Foo { ~Foo(); };"
+ "const Foo f = Foo();",
+ varDecl(hasInitializer(exprWithCleanups()))));
+ EXPECT_FALSE(matches("struct Foo { };"
+ "const Foo f = Foo();",
+ varDecl(hasInitializer(exprWithCleanups()))));
+}
+
TEST(InitListExpression, MatchesInitListExpression) {
EXPECT_TRUE(matches("int a[] = { 1, 2 };",
initListExpr(hasType(asString("int [2]")))));
OpenPOWER on IntegriCloud