[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)
Michael Jabbour via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 5 00:34:02 PST 2025
================
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New,
// Make the old tag definition visible.
makeMergedDefinitionVisible(Hidden);
- // If this was an unscoped enumeration, yank all of its enumerators
- // out of the scope.
- if (isa<EnumDecl>(NewTag)) {
- Scope *EnumScope = getNonFieldDeclScope(S);
- for (auto *D : NewTag->decls()) {
- auto *ED = cast<EnumConstantDecl>(D);
- assert(EnumScope->isDeclScope(ED));
- EnumScope->RemoveDecl(ED);
- IdResolver.RemoveDecl(ED);
- ED->getLexicalDeclContext()->removeDecl(ED);
----------------
michael-jabbour-sonarsource wrote:
Thank you all for looking into this :pray:
> Can we solve this issue by reusing some level of modules-specific declaration shadowing?
I am new to modules, and I only learned how this part of the code works while debugging the crash I am sharing here. I am not entirely sure I understand what this means, could you provide some pointers that I can start from (e.g. function names, commits, ...etc)?
I can try to dig into this at the end of this week or next week if needed...
https://github.com/llvm/llvm-project/pull/114240
More information about the cfe-commits
mailing list