[clang] [CodeGen] Add CodeGenModule::forgetDecl to discard cached mangled-name state (PR #234493)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 00:50:20 PST 2026
================
@@ -301,11 +323,29 @@ class ASTDeclUnmerger : public DeclVisitor<ASTDeclUnmerger> {
return Prev;
}
- void VisitFunctionDecl(FunctionDecl *D) { VisitRedeclarable(D); }
+ void VisitFunctionDecl(FunctionDecl *D) {
+ forgetMangledNames({GlobalDecl(D)});
+ VisitRedeclarable(D);
+ }
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D) { VisitRedeclarable(D); }
void VisitTypedefNameDecl(TypedefNameDecl *D) { VisitRedeclarable(D); }
void VisitUsingShadowDecl(UsingShadowDecl *D) { VisitRedeclarable(D); }
- void VisitVarDecl(VarDecl *D) { VisitRedeclarable(D); }
+ void VisitVarDecl(VarDecl *D) {
+ forgetMangledNames({GlobalDecl(D)});
+ VisitRedeclarable(D);
+ }
+
+ void VisitCXXConstructorDecl(CXXConstructorDecl *D) {
+ forgetMangledNames({GlobalDecl(D, Ctor_Complete), GlobalDecl(D, Ctor_Base),
+ GlobalDecl(D, Ctor_Comdat)});
----------------
vgvassilev wrote:
Are we sure we want to delete all of the allocation kinds here? Are they associated with that single `CXXConstructorDecl`?
https://github.com/llvm/llvm-project/pull/234493
More information about the cfe-commits
mailing list