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 | 5472a52c205ad38808322901eff02defb87e47ab (patch) | |
tree | 3752d4e3d804d8845fbb7aec78ea43c6e3b25650 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | 8b5297117b19a241984a224f3b72406b508bc963 (diff) | |
download | bcm5719-llvm-5472a52c205ad38808322901eff02defb87e47ab.tar.gz bcm5719-llvm-5472a52c205ad38808322901eff02defb87e47ab.zip |
Fixes crash in isDerivedFrom for recursive templates.
llvm-svn: 169262
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index f3d377b771f..f640dff16f6 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/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 |