summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
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