[SandboxIR] Add extern templates for GlobalWithNodeAPI#111940
[SandboxIR] Add extern templates for GlobalWithNodeAPI#111940vgvassilev merged 4 commits intollvm:mainfrom
Conversation
These symbols will need to be explicitly exported for SandboxIRTests when LLVM is built as shared library on window with explicitly visibility macros are enabled. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on window.
|
I am trying to understand why these would need to be explicitly exported for SandboxIRTests. The tests don't use the template directly. There are other similar CRTPs, like the |
|
idk if this helps much but these are the linker errors i get without this change, this is a debug build so a lot of stuff is not inlined:
I think those might of got exported from visibility macros that will be added on classes that derived from an instantiation of them like here https://github.com/fsfod/llvm-project/blob/fdf88b914978d57c6c75892a3133d4476b8995d1/llvm/include/llvm/SandboxIR/Instruction.h#L411 I just didn't want add them all in this PR. |
vporpo
left a comment
There was a problem hiding this comment.
LG, please add a brief comment that this is for LLVM_BUILD_LLVM_DYLIB.
| } | ||
| }; | ||
|
|
||
| extern template LLVM_TEMPLATE_ABI GlobalIFunc & |
There was a problem hiding this comment.
Please add a comment that this is for LLVM_BUILD_LLVM_DYLIB.
| template class GlobalWithNodeAPI<GlobalAlias, llvm::GlobalAlias, GlobalValue, | ||
| llvm::GlobalValue>; | ||
|
|
||
| template LLVM_EXPORT_TEMPLATE GlobalIFunc & |
|
This doesn't look right - why do we instantiate each of these templates twice? I'm seeing warnings from clang-cl now since there are duplicate instantiations between |
|
I have double checked again for shared library debug builds with clang-cl and the template function symbols are not exported without them being explicitly exported from the source file, explicit template instantiation of containing classes is not enough. I could add some clang warning suppression macros around them though. |
|
Do they need to be explicitly exported in both the header and the source file? That doesn't make a lot of sense to me. The instantiations look identical, as the warning implies. |
These symbols will need to be explicitly exported for SandboxIRTests when LLVM is built as shared library on window with explicitly visibility macros are enabled. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows.
These symbols will need to be explicitly exported for SandboxIRTests when LLVM is built as shared library on window with explicitly visibility macros are enabled.
This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on window.