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 /lib/ASTMatchers/ASTMatchFinder.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 'lib/ASTMatchers/ASTMatchFinder.cpp')
-rw-r--r-- | lib/ASTMatchers/ASTMatchFinder.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index c13cf4a277..7f89550573 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/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)) |