aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2025-08-06 09:13:36 -0700
committerGitHub <noreply@github.com>2025-08-06 09:13:36 -0700
commit09146a21a5a7bbea19b5203d585682de519a213c (patch)
tree37c290d662f091594fc605bc209ccdd608477d94 /llvm/lib
parent57045a137f97fe4e05d5d9581c0b2e4fd6c729e1 (diff)
downloadllvm-09146a21a5a7bbea19b5203d585682de519a213c.zip
llvm-09146a21a5a7bbea19b5203d585682de519a213c.tar.gz
llvm-09146a21a5a7bbea19b5203d585682de519a213c.tar.bz2
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/LTO/LTOModule.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index e0a9758..7dd0611 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;