diff options
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index 32b17fc..25de2a2 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -64,16 +64,14 @@ void CXXBasePaths::swap(CXXBasePaths &Other) { std::swap(DetectedVirtual, Other.DetectedVirtual); } -bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base, - bool LookupInDependentTypes) const { +bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base) const { CXXBasePaths Paths(/*FindAmbiguities=*/false, /*RecordPaths=*/false, /*DetectVirtual=*/false); - return isDerivedFrom(Base, Paths, LookupInDependentTypes); + return isDerivedFrom(Base, Paths); } bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base, - CXXBasePaths &Paths, - bool LookupInDependentTypes) const { + CXXBasePaths &Paths) const { if (getCanonicalDecl() == Base->getCanonicalDecl()) return false; @@ -85,7 +83,7 @@ bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base, return Specifier->getType()->getAsRecordDecl() && FindBaseClass(Specifier, Path, BaseDecl); }, - Paths, LookupInDependentTypes); + Paths); } bool CXXRecordDecl::isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const { @@ -248,16 +246,17 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context, } else if (VisitBase) { CXXRecordDecl *BaseRecord; if (LookupInDependent) { - BaseRecord = cast_if_present<CXXRecordDecl>( - BaseSpec.getType()->getAsRecordDecl()); - if (!BaseRecord) { - if (const TemplateSpecializationType *TST = - BaseSpec.getType()->getAs<TemplateSpecializationType>()) { - TemplateName TN = TST->getTemplateName(); - if (auto *TD = - dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl())) - BaseRecord = TD->getTemplatedDecl(); - } + BaseRecord = nullptr; + const TemplateSpecializationType *TST = + BaseSpec.getType()->getAs<TemplateSpecializationType>(); + if (!TST) { + if (auto *RT = BaseSpec.getType()->getAs<RecordType>()) + BaseRecord = cast<CXXRecordDecl>(RT->getDecl()); + } else { + TemplateName TN = TST->getTemplateName(); + if (auto *TD = + dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl())) + BaseRecord = TD->getTemplatedDecl(); } if (BaseRecord) { if (!BaseRecord->hasDefinition() || |