Add an AST matcher for checking whether a function is defaulted.
Patch by Jonathan Coe.
llvm-svn: 258072
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index c76100a..5fde0ff 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1814,6 +1814,13 @@
EXPECT_TRUE(notMatches("void f() {}", functionDecl(isExternC())));
}
+TEST(IsDefaulted, MatchesDefaultedFunctionDeclarations) {
+ EXPECT_TRUE(
+ notMatches("class A { ~A(); };", functionDecl(hasName("A"), isDefaulted())));
+ EXPECT_TRUE(matches("class B { ~B() = default; };",
+ functionDecl(hasName("B"), isDefaulted())));
+}
+
TEST(IsDeleted, MatchesDeletedFunctionDeclarations) {
EXPECT_TRUE(
notMatches("void Func();", functionDecl(hasName("Func"), isDeleted())));