[clang] [llvm] [LLVM][Support] Enforce proper instantiations of `Registry<T>` (PR #185141)
Tomohiro Kashiwada via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 03:05:54 PDT 2026
kikairoya wrote:
> Why does the non-Windows case not set visibility for the definition?
This is the existing behavior. https://github.com/llvm/llvm-project/commit/b735c66da9c9ae752b88941d466895a0b696c75e
> This changes semantics meaningfully: the template is no longer external and thus will be instantiated everywhere and require COMDAT semantics. Is this intentional?
For `Registry<T>` itself, yes. To catch a missing explicit instantiation declaration, we need to hide the definition, or to avoid requirement of the declaration, i.e., instantiate implicitly.
> Does it have measured perf implications that we should consider?
I haven't measured, however, accessing `Registry<T>` shouldn't be in a hot-path, so I think there is no major impact.
For build-time, `Registry<T>` itself is a quite simple template, and I don't think so many TUs instantiate it with the same parameters, so I guess it's not significant.
https://github.com/llvm/llvm-project/pull/185141
More information about the cfe-commits
mailing list