summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-07-06 21:36:04 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-07-06 21:36:04 +0000
commitba02bc5226546d4883ae43d96a593313742302e5 (patch)
tree3e641fadb31a452514f9cafc5823640cfff15c4d /clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
parentf5d8b841cef28e1d21bcf6f2757143b94875981b (diff)
downloadbcm5719-llvm-ba02bc5226546d4883ae43d96a593313742302e5.tar.gz
bcm5719-llvm-ba02bc5226546d4883ae43d96a593313742302e5.zip
[ASTMatchers] A matcher for Objective-C @autoreleasepool
Differential Revision: https://reviews.llvm.org/D48910 llvm-svn: 336468
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index 8947ccde7a4..fc1a57c4885 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1687,5 +1687,17 @@ TEST(ObjCStmtMatcher, ExceptionStmts) {
objcFinallyStmt()));
}
+TEST(ObjCAutoreleaseMatcher, AutoreleasePool) {
+ std::string ObjCString =
+ "void f() {"
+ "@autoreleasepool {"
+ " int x = 1;"
+ "}"
+ "}";
+ EXPECT_TRUE(matchesObjC(ObjCString, autoreleasePoolStmt()));
+ std::string ObjCStringNoPool = "void f() { int x = 1; }";
+ EXPECT_FALSE(matchesObjC(ObjCStringNoPool, autoreleasePoolStmt()));
+}
+
} // namespace ast_matchers
} // namespace clang
OpenPOWER on IntegriCloud