================
@@ -2639,6 +2628,19 @@ void Sema::MergeTypedefNameDecl(Scope *S, 
TypedefNameDecl *New,
   notePreviousDefinition(Old, New->getLocation());
 }
 
+void Sema::CleanupMergedEnum(Scope *S, Decl *New) {
----------------
michael-jabbour-sonarsource wrote:

> Is MergeTypedefNameDecl not called for the motivating example?

Unfortunately, it seems to me that `MergeTypedefNameDecl` is only called in the 
typedef to anonymous enum case (`MyEnum3` in the test case I am adding). For 
the rest of the enum cases, the closest I found was 
`Sema::ActOnDuplicateDefinition`, which is called when merging all tags (and 
this is where I am adding the new call to `CleanupMergedEnum`).

> Can we find a common path when merging definitions to put that logic there?

I could only see that merging enums for C and Obj-C crashes in this case (C++ 
works differently, see 
[here](https://github.com/llvm/llvm-project/pull/114240#issuecomment-2614544626)),
 and I found `Sema::ActOnDuplicateDefinition` during my investigation to be the 
function that handles merging tags.

I am not aware of a central place for merging definitions in general. Could you 
provide some hints on what to look for?

https://github.com/llvm/llvm-project/pull/114240
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to