mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Make parseBitcodeFile return an ErrorOr<Module *>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199279 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -30,16 +30,16 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutModule,
|
||||
char **OutMessage) {
|
||||
std::string Message;
|
||||
|
||||
*OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef),
|
||||
&Message));
|
||||
if (!*OutModule) {
|
||||
ErrorOr<Module *> ModuleOrErr =
|
||||
parseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef));
|
||||
if (error_code EC = ModuleOrErr.getError()) {
|
||||
if (OutMessage)
|
||||
*OutMessage = strdup(Message.c_str());
|
||||
*OutMessage = strdup(EC.message().c_str());
|
||||
*OutModule = wrap((Module*)0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
*OutModule = wrap(ModuleOrErr.get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user