summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchFinder.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2012-12-04 13:40:29 +0000
committerManuel Klimek <klimek@google.com>2012-12-04 13:40:29 +0000
commit5472a52c205ad38808322901eff02defb87e47ab (patch)
tree3752d4e3d804d8845fbb7aec78ea43c6e3b25650 /clang/lib/ASTMatchers/ASTMatchFinder.cpp
parent8b5297117b19a241984a224f3b72406b508bc963 (diff)
downloadbcm5719-llvm-5472a52c205ad38808322901eff02defb87e47ab.tar.gz
bcm5719-llvm-5472a52c205ad38808322901eff02defb87e47ab.zip
Fixes crash in isDerivedFrom for recursive templates.
llvm-svn: 169262
Diffstat (limited to 'clang/lib/ASTMatchers/ASTMatchFinder.cpp')
-rw-r--r--clang/lib/ASTMatchers/ASTMatchFinder.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index c13cf4a277f..7f89550573f 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -605,7 +605,12 @@ bool MatchASTVisitor::classIsDerivedFrom(const CXXRecordDecl *Declaration,
ClassDecl = TypeNode->getAsCXXRecordDecl();
}
assert(ClassDecl != NULL);
- assert(ClassDecl != Declaration);
+ if (ClassDecl == Declaration) {
+ // This can happen for recursive template definitions; if the
+ // current declaration did not match, we can safely return false.
+ assert(TemplateType);
+ return false;
+ }
if (Base.matches(*ClassDecl, this, Builder))
return true;
if (classIsDerivedFrom(ClassDecl, Base, Builder))
OpenPOWER on IntegriCloud