aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2023-02-23 17:08:47 +0100
committerAlexander Kornienko <alexfh@google.com>2023-02-23 17:31:04 +0100
commit1812e13a3d6be9a838672ff74b3d9d383f5a83b5 (patch)
treeebc947b586bd49d5ebc7036ba57c18b3dfc8f9a3 /clang/lib/AST/CXXInheritance.cpp
parente77fc0dd76ab2aade6fed2358dbc603c0c80d20c (diff)
downloadllvm-1812e13a3d6be9a838672ff74b3d9d383f5a83b5.zip
llvm-1812e13a3d6be9a838672ff74b3d9d383f5a83b5.tar.gz
llvm-1812e13a3d6be9a838672ff74b3d9d383f5a83b5.tar.bz2
Revert "[clang] Add the check of membership for the issue #58674 and improve the lookup process"
The commit causes clang to crash. See https://reviews.llvm.org/D143840#4147234 This reverts commit 8498ba6c2860c838183f9951b63df26ab5f02265.
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r--clang/lib/AST/CXXInheritance.cpp31
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() ||