diff options
author | Manuel Klimek <klimek@google.com> | 2012-12-04 13:40:29 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2012-12-04 13:40:29 +0000 |
commit | 987c2f590fade75245e32807ee83c31483e02d8a (patch) | |
tree | 1ba7435affdb9738076825d6dc4972eccde482c4 /unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | 8822d3a99c07c7d874f8bfd81a7fe02059b9c19e (diff) |
Fixes crash in isDerivedFrom for recursive templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index f3d377b771..f640dff16f 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -232,6 +232,17 @@ TEST(DeclarationMatcher, ClassIsDerived) { "template <> class Z<void> {};" "template <typename T> class Z : public Z<void>, public X {};", ZIsDerivedFromX)); + EXPECT_TRUE( + notMatches("template<int> struct X;" + "template<int i> struct X : public X<i-1> {};", + recordDecl(isDerivedFrom(recordDecl(hasName("Some")))))); + EXPECT_TRUE(matches( + "struct A {};" + "template<int> struct X;" + "template<int i> struct X : public X<i-1> {};" + "template<> struct X<0> : public A {};" + "struct B : public X<42> {};", + recordDecl(hasName("B"), isDerivedFrom(recordDecl(hasName("A")))))); // FIXME: Once we have better matchers for template type matching, // get rid of the Variable(...) matching and match the right template |