[LTO] Return proper error object rather than null LTOModule

This caused a crash in LTOModule::createInLocalContext.

rdar://37926841

llvm-svn: 327359
This commit is contained in:
Adam Nemet 2018-03-13 04:37:01 +00:00
parent 7646e77969
commit ade40dd3c8
1 changed files with 1 additions and 1 deletions

View File

@ -208,7 +208,7 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
std::string errMsg;
const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg);
if (!march)
return std::unique_ptr<LTOModule>(nullptr);
return make_error_code(object::object_error::arch_not_found);
// construct LTOModule, hand over ownership of module and target
SubtargetFeatures Features;