mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Update getLazyBitcodeModule to use ErrorOr for error handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199125 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -36,15 +36,16 @@ Module *llvm::getLazyIRModule(MemoryBuffer *Buffer, SMDiagnostic &Err,
|
||||
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
|
||||
(const unsigned char *)Buffer->getBufferEnd())) {
|
||||
std::string ErrMsg;
|
||||
Module *M = getLazyBitcodeModule(Buffer, Context, &ErrMsg);
|
||||
if (M == 0) {
|
||||
ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModule(Buffer, Context);
|
||||
if (error_code EC = ModuleOrErr.getError()) {
|
||||
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
|
||||
ErrMsg);
|
||||
EC.message());
|
||||
// ParseBitcodeFile does not take ownership of the Buffer in the
|
||||
// case of an error.
|
||||
delete Buffer;
|
||||
return NULL;
|
||||
}
|
||||
return M;
|
||||
return ModuleOrErr.get();
|
||||
}
|
||||
|
||||
return ParseAssembly(Buffer, 0, Err, Context);
|
||||
|
Reference in New Issue
Block a user