Skip to content

Commit 09146a2

Browse files
[LegacyLTO] Emit the error message that was silently dropped (#152172)
Using LLVMContext to emit the error from `TargetRegistry::lookupTarget` that was silently ignored and not propagated. This allows user to better identify the kind of error occured. rdar://157542119
1 parent 57045a1 commit 09146a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/LTO/LTOModule.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
203203
// find machine architecture for this module
204204
std::string errMsg;
205205
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
206-
if (!march)
206+
if (!march) {
207+
Context.emitError(errMsg);
207208
return make_error_code(object::object_error::arch_not_found);
209+
}
208210

209211
// construct LTOModule, hand over ownership of module and target
210212
SubtargetFeatures Features;

0 commit comments

Comments
 (0)