summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-01-20 16:26:48 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-01-20 16:26:48 +0000
commit2b6963fce925dbaaffc83ea6b62f5a77baf84665 (patch)
tree002bf0d4ed4280c3cb73ba52f836d2255c287963 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parente8295d7980225c91d2c616f771448f6b5bda3f5b (diff)
downloadbcm5719-llvm-2b6963fce925dbaaffc83ea6b62f5a77baf84665.tar.gz
bcm5719-llvm-2b6963fce925dbaaffc83ea6b62f5a77baf84665.zip
Add AST matcher support for FunctionDecls with the hasBody matcher.
Patch by Aleksei Sidorin. llvm-svn: 258322
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index d7f5b722df3..3cf396a4fd9 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2973,6 +2973,10 @@ TEST(HasBody, FindsBodyOfForWhileDoLoops) {
doStmt(hasBody(compoundStmt()))));
EXPECT_TRUE(matches("void f() { int p[2]; for (auto x : p) {} }",
cxxForRangeStmt(hasBody(compoundStmt()))));
+ EXPECT_TRUE(matches("void f() {}", functionDecl(hasBody(compoundStmt()))));
+ EXPECT_TRUE(notMatches("void f();", functionDecl(hasBody(compoundStmt()))));
+ EXPECT_TRUE(matches("void f(); void f() {}",
+ functionDecl(hasBody(compoundStmt()))));
}
TEST(HasAnySubstatement, MatchesForTopLevelCompoundStatement) {
OpenPOWER on IntegriCloud