[clang] [llvm] Update llvm::Registry to work for LLVM shared library builds on windows (PR #109024)

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 08:49:04 PDT 2024


john-brawn-arm wrote:

> @john-brawn-arm This may be hard to remember, but this a path you've tread before could the LLVM_INSTANTIATE_REGISTRY just be changed to a fulll class explicit template instantiation?

It looks like the approach you're going for is:
 * Registry<Whatever> is declared as extern template in header file. In clang.dll it has no explicit import/export, in plugin.dll it is dllimport
 * In a .cpp file in clang there is an explicit instantiation of Registry<Whatever> with dllexport

Yes, I think LLVM_INSTANTIATE_REGISTRY can just be a explicit instantiation of the template class, as using extern template in the header gets rid of the reason that the current implementation exists.

https://github.com/llvm/llvm-project/pull/109024


More information about the cfe-commits mailing list