Fix compile error with LLVM 3.6.

The llvm::Linker class now uses diagnostic messages.
This commit is contained in:
kai 2014-10-25 17:39:42 +02:00
parent 53ee723279
commit cc829485cc
2 changed files with 14 additions and 2 deletions

View file

@ -915,6 +915,11 @@ static void emitEntryPointInto(llvm::Module* lm)
emitSymbolAddrGlobal(*entryModule, "_end", "_d_execBssEndAddr"); emitSymbolAddrGlobal(*entryModule, "_end", "_d_execBssEndAddr");
} }
#if LDC_LLVM_VER >= 306
// FIXME: A possible error message is written to the diagnostic context
// Do we show these messages?
linker.linkInModule(entryModule);
#else
std::string linkError; std::string linkError;
#if LDC_LLVM_VER >= 303 #if LDC_LLVM_VER >= 303
const bool hadError = linker.linkInModule(entryModule, &linkError); const bool hadError = linker.linkInModule(entryModule, &linkError);
@ -924,6 +929,7 @@ static void emitEntryPointInto(llvm::Module* lm)
#endif #endif
if (hadError) if (hadError)
error(Loc(), "%s", linkError.c_str()); error(Loc(), "%s", linkError.c_str());
#endif
} }
@ -1364,12 +1370,16 @@ int main(int argc, char **argv)
std::string errormsg; std::string errormsg;
for (size_t i = 0; i < llvmModules.size(); i++) for (size_t i = 0; i < llvmModules.size(); i++)
{ {
#if LDC_LLVM_VER >= 306
linker.linkInModule(llvmModules[i], llvm::Linker::DestroySource);
#else
#if LDC_LLVM_VER >= 303 #if LDC_LLVM_VER >= 303
if (linker.linkInModule(llvmModules[i], llvm::Linker::DestroySource, &errormsg)) if (linker.linkInModule(llvmModules[i], llvm::Linker::DestroySource, &errormsg))
#else #else
if (linker.LinkInModule(llvmModules[i], &errormsg)) if (linker.LinkInModule(llvmModules[i], &errormsg))
#endif #endif
error(Loc(), "%s", errormsg.c_str()); error(Loc(), "%s", errormsg.c_str());
#endif
delete llvmModules[i]; delete llvmModules[i];
} }

View file

@ -403,9 +403,11 @@ LLFunction* DtoInlineIRFunction(FuncDeclaration* fdecl)
(std::string(err.getColumnNo(), ' ') + '^').c_str(), (std::string(err.getColumnNo(), ' ') + '^').c_str(),
errstr.c_str(), stream.str().c_str()); errstr.c_str(), stream.str().c_str());
#if LDC_LLVM_VER >= 303
std::string errstr2 = "";
#if LDC_LLVM_VER >= 306 #if LDC_LLVM_VER >= 306
llvm::Linker(gIR->module).linkInModule(m.get());
#else
std::string errstr2 = "";
#if LDC_LLVM_VER >= 303
llvm::Linker(gIR->module).linkInModule(m.get(), &errstr2); llvm::Linker(gIR->module).linkInModule(m.get(), &errstr2);
#else #else
llvm::Linker(gIR->module).linkInModule(m, &errstr2); llvm::Linker(gIR->module).linkInModule(m, &errstr2);