[clang] [clang-repl] fix vtable symbol duplication error (closes #141039) (PR #185648)
Emery Conrad via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 08:33:43 PDT 2026
conrade-ctc wrote:
> I believe we should be looking at why this function decides to emit the vtable twice:
>
> https://github.com/llvm/llvm-project/blob/3548ec95178c00a2895a65b435945ce318396c8e/clang/lib/CodeGen/CodeGenModule.cpp#L3680
>
> The reset happens probably here
>
> https://github.com/llvm/llvm-project/blob/3548ec95178c00a2895a65b435945ce318396c8e/clang/lib/CodeGen/CodeGenModule.cpp#L8496
So, consulting claude ;/, the root cause is that there are as you suggest, and there is a ~10 fix to address that is a bit more intrusive that the handling in the linkage. However, it gave this helpful note: "The LinkOnceODRLinkage fix mirrors how implicit template instantiation vtables already work across TUs and is arguably the right semantic fit. The DefinedVTables tracking approach is more precise and avoids the redundant emission entirely, but is more invasive. Whether to pursue it would be a question for the upstream review."
How about this: I'll add the other fix in another commit (that removes the previous fix), and if you think it is more maintainable and is arguably the correct fix so that it doesn't intersect with linkage, we can squash before approval and merge. Make sense? I'll push commit in a few minutes.
https://github.com/llvm/llvm-project/pull/185648
More information about the cfe-commits
mailing list