llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: eiytoq (eiytoq) <details> <summary>Changes</summary> This patch removes an out-of-date FIXME. The underlying issue was already fixed by `Sema::adjustContextForLocalExternDecl` in `clang/lib/Sema/SemaDecl.cpp`. --- Full diff: https://github.com/llvm/llvm-project/pull/186665.diff 2 Files Affected: - (modified) clang/lib/AST/ItaniumMangle.cpp (+2-13) - (modified) clang/lib/AST/MicrosoftMangle.cpp (-9) ``````````diff diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index eea04b14eaf09..391485bea05b3 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -800,10 +800,6 @@ bool ItaniumMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) { // Variables at global scope are not mangled unless they have internal // linkage or are specializations or are attached to a named module. const DeclContext *DC = getEffectiveDeclContext(D); - // Check for extern variable declared locally. - if (DC->isFunctionOrMethod() && D->hasLinkage()) - while (!DC->isFileContext()) - DC = getEffectiveParentContext(DC); if (DC->isTranslationUnit() && D->getFormalLinkage() != Linkage::Internal && !CXXNameMangler::shouldHaveAbiTags(*this, VD) && !isa<VarTemplateSpecializationDecl>(VD) && @@ -1077,15 +1073,8 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD, const DeclContext *DC = Context.getEffectiveDeclContext(ND); bool IsLambda = isLambda(ND); - // If this is an extern variable declared locally, the relevant DeclContext - // is that of the containing namespace, or the translation unit. - // FIXME: This is a hack; extern variables declared locally should have - // a proper semantic declaration context! - if (isLocalContainerContext(DC) && ND->hasLinkage() && !IsLambda) - while (!DC->isNamespace() && !DC->isTranslationUnit()) - DC = Context.getEffectiveParentContext(DC); - else if (GetLocalClassDecl(ND) && - (!IsLambda || isCompatibleWith(LangOptions::ClangABI::Ver18))) { + if (GetLocalClassDecl(ND) && + (!IsLambda || isCompatibleWith(LangOptions::ClangABI::Ver18))) { mangleLocalName(GD, AdditionalAbiTags); return; } diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 1bf92d4209f9f..196f2009d84cf 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -122,10 +122,6 @@ static const DeclContext *getEffectiveDeclContext(const Decl *D) { return DC->getRedeclContext(); } -static const DeclContext *getEffectiveParentContext(const DeclContext *DC) { - return getEffectiveDeclContext(cast<Decl>(DC)); -} - static const FunctionDecl *getStructor(const NamedDecl *ND) { if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND)) return FTD->getTemplatedDecl()->getCanonicalDecl(); @@ -557,11 +553,6 @@ bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) { // Variables at global scope with internal linkage are not mangled. const DeclContext *DC = getEffectiveDeclContext(D); - // Check for extern variable declared locally. - if (DC->isFunctionOrMethod() && D->hasLinkage()) - while (!DC->isNamespace() && !DC->isTranslationUnit()) - DC = getEffectiveParentContext(DC); - if (DC->isTranslationUnit() && D->getFormalLinkage() == Linkage::Internal && !isa<VarTemplateSpecializationDecl>(D) && D->getIdentifier() != nullptr) return false; `````````` </details> https://github.com/llvm/llvm-project/pull/186665 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
