diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-11-10 01:18:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-11-10 01:18:17 +0000 |
commit | 6200470112118250985191b74468adfd99f3a8cf (patch) | |
tree | 39cc3f99108c3e2e8ba2af595b58bede9ed75734 /clang/lib/AST/CXXInheritance.cpp | |
parent | 1c9c90495dd74f568383ffa8fc47f3addf303db8 (diff) | |
download | bcm5719-llvm-6200470112118250985191b74468adfd99f3a8cf.tar.gz bcm5719-llvm-6200470112118250985191b74468adfd99f3a8cf.zip |
Diagnostic circular inheritance involving dependent base classes. We
would have diagnosed this at instantiation time anyway, if only we
didn't hang on all of these test cases. Fixes <rdar://problem/12629723>
llvm-svn: 167651
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index 213b214a4e4..6e91f3f9105 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -123,7 +123,8 @@ bool CXXRecordDecl::isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const { bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, void *OpaqueData, - bool AllowShortCircuit) const { + bool AllowShortCircuit, + bool VisitDependent) const { SmallVector<const CXXRecordDecl*, 8> Queue; const CXXRecordDecl *Record = this; @@ -131,15 +132,14 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, while (true) { for (CXXRecordDecl::base_class_const_iterator I = Record->bases_begin(), E = Record->bases_end(); I != E; ++I) { - const RecordType *Ty = I->getType()->getAs<RecordType>(); - if (!Ty) { + CXXRecordDecl *Base = I->getType()->getAsCXXRecordDecl(); + if (!Base || (!VisitDependent && I->getType()->isDependentType())) { if (AllowShortCircuit) return false; AllMatches = false; continue; } - CXXRecordDecl *Base = - cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition()); + Base = Base->getDefinition(); if (!Base) { if (AllowShortCircuit) return false; AllMatches = false; |