From 4c0c9719678d6a3a7f3cbb7ea6f513bef57180bf Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Fri, 15 Jun 2018 08:21:39 +0200 Subject: llvm38: adapt to new Linker::linkModules LLVM commit d912be98f8eb changed the prototype of linkModules to accept std::unique_ptr. Adapt to that. Signed-off-by: Jiri Slaby --- lib/Module/ModuleUtil.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 &UndefinedSymbols) { static bool linkTwoModules(llvm::Module *Dest, std::unique_ptr 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( -- cgit 1.4.1