diff --git a/llvm/include/llvm/SandboxIR/Constant.h b/llvm/include/llvm/SandboxIR/Constant.h index 6eafdefde60262..17f55e973cd764 100644 --- a/llvm/include/llvm/SandboxIR/Constant.h +++ b/llvm/include/llvm/SandboxIR/Constant.h @@ -22,6 +22,7 @@ #include "llvm/SandboxIR/Context.h" #include "llvm/SandboxIR/Type.h" #include "llvm/SandboxIR/User.h" +#include "llvm/Support/Compiler.h" namespace llvm::sandboxir { @@ -797,6 +798,25 @@ class GlobalWithNodeAPI : public ParentT { } }; +// These are needed for SandboxIRTest when building with LLVM_BUILD_LLVM_DYLIB +extern template LLVM_TEMPLATE_ABI GlobalIFunc & +GlobalWithNodeAPI::LLVMGVToGV::operator()(llvm::GlobalIFunc + &LLVMGV) + const; +extern template LLVM_TEMPLATE_ABI Function & +GlobalWithNodeAPI:: + LLVMGVToGV::operator()(llvm::Function &LLVMGV) const; + +extern template LLVM_TEMPLATE_ABI GlobalVariable &GlobalWithNodeAPI< + GlobalVariable, llvm::GlobalVariable, GlobalObject, + llvm::GlobalObject>::LLVMGVToGV::operator()(llvm::GlobalVariable &LLVMGV) + const; +extern template LLVM_TEMPLATE_ABI GlobalAlias & +GlobalWithNodeAPI::LLVMGVToGV::operator()(llvm::GlobalAlias + &LLVMGV) const; + class GlobalIFunc final : public GlobalWithNodeAPI { diff --git a/llvm/lib/SandboxIR/Constant.cpp b/llvm/lib/SandboxIR/Constant.cpp index f26c004f630925..3e13c935c42811 100644 --- a/llvm/lib/SandboxIR/Constant.cpp +++ b/llvm/lib/SandboxIR/Constant.cpp @@ -11,6 +11,7 @@ #include "llvm/SandboxIR/BasicBlock.h" #include "llvm/SandboxIR/Context.h" #include "llvm/SandboxIR/Function.h" +#include "llvm/Support/Compiler.h" namespace llvm::sandboxir { @@ -301,6 +302,27 @@ template class GlobalWithNodeAPI; +#ifdef _MSC_VER +// These are needed for SandboxIRTest when building with LLVM_BUILD_LLVM_DYLIB +template LLVM_EXPORT_TEMPLATE GlobalIFunc & +GlobalWithNodeAPI::LLVMGVToGV::operator()(llvm::GlobalIFunc + &LLVMGV) + const; +template LLVM_EXPORT_TEMPLATE Function & +GlobalWithNodeAPI:: + LLVMGVToGV::operator()(llvm::Function &LLVMGV) const; + +template LLVM_EXPORT_TEMPLATE GlobalVariable &GlobalWithNodeAPI< + GlobalVariable, llvm::GlobalVariable, GlobalObject, + llvm::GlobalObject>::LLVMGVToGV::operator()(llvm::GlobalVariable &LLVMGV) + const; +template LLVM_EXPORT_TEMPLATE GlobalAlias & +GlobalWithNodeAPI::LLVMGVToGV::operator()(llvm::GlobalAlias + &LLVMGV) const; +#endif + void GlobalIFunc::setResolver(Constant *Resolver) { Ctx.getTracker() .emplaceIfTracking<