diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 4 | ||||
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Interpreter.cpp | 5 | ||||
-rw-r--r-- | lib/IR/Module.cpp | 12 | ||||
-rw-r--r-- | lib/LTO/LTOModule.cpp | 2 |
4 files changed, 13 insertions, 10 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 81ed803ba0..c36dae892c 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3359,7 +3359,9 @@ Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext& Context, static_cast<BitcodeReader*>(M->getMaterializer())->setBufferOwned(false); // Read in the entire module, and destroy the BitcodeReader. - if (M->MaterializeAllPermanently(ErrMsg)) { + if (error_code EC = M->materializeAllPermanently()) { + if (ErrMsg) + *ErrMsg = EC.message(); delete M; return 0; } diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp index 9ee9d9456d..6d4f6f716f 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp +++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp @@ -34,9 +34,12 @@ extern "C" void LLVMLinkInInterpreter() { } /// ExecutionEngine *Interpreter::create(Module *M, std::string* ErrStr) { // Tell this Module to materialize everything and release the GVMaterializer. - if (M->MaterializeAllPermanently(ErrStr)) + if (error_code EC = M->materializeAllPermanently()) { + if (ErrStr) + *ErrStr = EC.message(); // We got an error, just return 0 return 0; + } return new Interpreter(M); } diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp index 06eea7e388..d911c7e2b5 100644 --- a/lib/IR/Module.cpp +++ b/lib/IR/Module.cpp @@ -383,14 +383,12 @@ error_code Module::materializeAll() { return Materializer->MaterializeModule(this); } -bool Module::MaterializeAllPermanently(std::string *ErrInfo) { - if (error_code EC = materializeAll()) { - if (ErrInfo) - *ErrInfo = EC.message(); - return true; - } +error_code Module::materializeAllPermanently() { + if (error_code EC = materializeAll()) + return EC; + Materializer.reset(); - return false; + return error_code::success(); } //===----------------------------------------------------------------------===// diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp index dcfd59e752..79cff1f68f 100644 --- a/lib/LTO/LTOModule.cpp +++ b/lib/LTO/LTOModule.cpp @@ -169,7 +169,7 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer, TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr, options); - m->MaterializeAllPermanently(); + m->materializeAllPermanently(); LTOModule *Ret = new LTOModule(m.take(), target); if (Ret->parseSymbols(errMsg)) { |