summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/ASTMatchers')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index 0fedb0c8d60..cb5cf9ebf52 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -566,6 +566,13 @@ TEST(DeclarationMatcher, ClassIsDerived) {
cxxRecordDecl(isDerivedFrom(namedDecl(hasName("X"))))));
}
+TEST(DeclarationMatcher, IsDerivedFromEmptyName) {
+ const char *const Code = "class X {}; class Y : public X {};";
+ EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isDerivedFrom(""))));
+ EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isDirectlyDerivedFrom(""))));
+ EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isSameOrDerivedFrom(""))));
+}
+
TEST(DeclarationMatcher, IsLambda) {
const auto IsLambda = cxxMethodDecl(ofClass(cxxRecordDecl(isLambda())));
EXPECT_TRUE(matches("auto x = []{};", IsLambda));
OpenPOWER on IntegriCloud