diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-07-06 21:36:04 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-07-06 21:36:04 +0000 |
commit | ba02bc5226546d4883ae43d96a593313742302e5 (patch) | |
tree | 3e641fadb31a452514f9cafc5823640cfff15c4d /clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp | |
parent | f5d8b841cef28e1d21bcf6f2757143b94875981b (diff) | |
download | bcm5719-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.cpp | 12 |
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 |