if (!ClassDecl)
continue;
if (ClassDecl == Declaration) {
- // This can happen for recursive template definitions; if the
- // current declaration did not match, we can safely return false.
- return false;
+ // This can happen for recursive template definitions.
+ continue;
}
BoundNodesTreeBuilder Result(*Builder);
if (Base.matches(*ClassDecl, this, &Result)) {
EXPECT_TRUE(notMatches("class X;", IsDerivedFromX));
EXPECT_TRUE(notMatches("class Y;", IsDerivedFromX));
EXPECT_TRUE(notMatches("", IsDerivedFromX));
+ EXPECT_TRUE(matches("class X {}; template<int N> class Y : Y<N-1>, X {};",
+ IsDerivedFromX));
+ EXPECT_TRUE(matches("class X {}; template<int N> class Y : X, Y<N-1> {};",
+ IsDerivedFromX));
+
+ DeclarationMatcher IsZDerivedFromX = cxxRecordDecl(hasName("Z"),
+ isDerivedFrom("X"));
+ EXPECT_TRUE(
+ matches(
+ "class X {};"
+ "template<int N> class Y : Y<N-1> {};"
+ "template<> class Y<0> : X {};"
+ "class Z : Y<1> {};",
+ IsZDerivedFromX));
DeclarationMatcher IsDirectlyDerivedFromX =
cxxRecordDecl(isDirectlyDerivedFrom("X"));