diff options
-rw-r--r-- | lib/Module/ModuleUtil.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 4f2fdf19..37c957ba 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -159,7 +159,12 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) { static bool linkTwoModules(llvm::Module *Dest, std::unique_ptr<llvm::Module> Src, std::string &errorMsg) { -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) + // Get the potential error message (Src is moved and won't be available later) + errorMsg = "Linking module " + Src->getModuleIdentifier() + " failed"; + auto linkResult = Linker::linkModules(*Dest, std::move(Src)); +#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) raw_string_ostream Stream(errorMsg); DiagnosticPrinterRawOStream DP(Stream); auto linkResult = Linker::LinkModules( |