diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-14 23:17:03 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-14 23:17:03 +0000 |
commit | 9d2bfc48741a5c0c3a3eb455959a627afcc3b722 (patch) | |
tree | fe5cca4dadc85dbb69e9636da588d269ba63b92c /llvm/lib/LTO | |
parent | 2cb8a51c1f771437a0207c4c71e2d6273a4a3550 (diff) | |
download | bcm5719-llvm-9d2bfc48741a5c0c3a3eb455959a627afcc3b722.tar.gz bcm5719-llvm-9d2bfc48741a5c0c3a3eb455959a627afcc3b722.zip |
Use diagnostic handler in the LLVMContext
This patch converts code that has access to a LLVMContext to not take a
diagnostic handler.
This has a few advantages
* It is easier to use a consistent diagnostic handler in a single program.
* Less clutter since we are not passing a handler around.
It does make it a bit awkward to implement some C APIs that return a
diagnostic string. I will propose new versions of these APIs and
deprecate the current ones.
llvm-svn: 255571
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r-- | llvm/lib/LTO/LTOCodeGenerator.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/LTO/LTOModule.cpp | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index bf3cde59443..525ca37c2f1 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -66,9 +66,7 @@ const char* LTOCodeGenerator::getVersionString() { LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context) : Context(Context), MergedModule(new Module("ld-temp.o", Context)), - IRLinker(new Linker(*MergedModule, [this](const DiagnosticInfo &DI) { - MergedModule->getContext().diagnose(DI); - })) { + IRLinker(new Linker(*MergedModule)) { initializeLTOPasses(); } @@ -124,8 +122,7 @@ void LTOCodeGenerator::setModule(std::unique_ptr<LTOModule> Mod) { AsmUndefinedRefs.clear(); MergedModule = Mod->takeModule(); - IRLinker = llvm::make_unique<Linker>(*MergedModule, - IRLinker->getDiagnosticHandler()); + IRLinker = make_unique<Linker>(*MergedModule); const std::vector<const char*> &Undefs = Mod->getAsmUndefinedRefs(); for (int I = 0, E = Undefs.size(); I != E; ++I) diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp index a6a3002e457..409b9490233 100644 --- a/llvm/lib/LTO/LTOModule.cpp +++ b/llvm/lib/LTO/LTOModule.cpp @@ -172,9 +172,8 @@ parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context, // Parse lazily. std::unique_ptr<MemoryBuffer> LightweightBuf = MemoryBuffer::getMemBuffer(*MBOrErr, false); - ErrorOr<std::unique_ptr<Module>> M = - getLazyBitcodeModule(std::move(LightweightBuf), Context, nullptr, - true /*ShouldLazyLoadMetadata*/); + ErrorOr<std::unique_ptr<Module>> M = getLazyBitcodeModule( + std::move(LightweightBuf), Context, true /*ShouldLazyLoadMetadata*/); if (std::error_code EC = M.getError()) return EC; return std::move(*M); |