[llvm] 09146a2 - [LegacyLTO] Emit the error message that was silently dropped (#152172)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 09:13:39 PDT 2025
Author: Steven Wu
Date: 2025-08-06T09:13:36-07:00
New Revision: 09146a21a5a7bbea19b5203d585682de519a213c
URL: https://github.com/llvm/llvm-project/commit/09146a21a5a7bbea19b5203d585682de519a213c
DIFF: https://github.com/llvm/llvm-project/commit/09146a21a5a7bbea19b5203d585682de519a213c.diff
LOG: [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
Added:
Modified:
llvm/lib/LTO/LTOModule.cpp
Removed:
################################################################################
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index e0a975806a31d..7dd06118e2a57 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -203,8 +203,10 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
// find machine architecture for this module
std::string errMsg;
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
- if (!march)
+ if (!march) {
+ Context.emitError(errMsg);
return make_error_code(object::object_error::arch_not_found);
+ }
// construct LTOModule, hand over ownership of module and target
SubtargetFeatures Features;
More information about the llvm-commits
mailing list