aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-ml/llvm-ml.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-09-17 12:10:14 +0900
committerGitHub <noreply@github.com>2025-09-17 12:10:14 +0900
commita57c583861d209f440ffa937a29979e116b4716e (patch)
tree9936572d67be2060563807b1de9219b7f38bf215 /llvm/tools/llvm-ml/llvm-ml.cpp
parent7dc7d0e1294cd29fb13b53aaca3f97c266bcbd3d (diff)
downloadllvm-a57c583861d209f440ffa937a29979e116b4716e.zip
llvm-a57c583861d209f440ffa937a29979e116b4716e.tar.gz
llvm-a57c583861d209f440ffa937a29979e116b4716e.tar.bz2
llvm-ml: Error on MCSubtargetInfo construction failure (#159221)
Replace assert with an error.
Diffstat (limited to 'llvm/tools/llvm-ml/llvm-ml.cpp')
-rw-r--r--llvm/tools/llvm-ml/llvm-ml.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index ae58b0d..cda86e7 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -325,7 +325,10 @@ int llvm_ml_main(int Argc, char **Argv, const llvm::ToolContext &) {
std::unique_ptr<MCSubtargetInfo> STI(
TheTarget->createMCSubtargetInfo(TheTriple, /*CPU=*/"", /*Features=*/""));
- assert(STI && "Unable to create subtarget info!");
+ if (!STI) {
+ WithColor::error(errs(), ProgName) << "unable to create subtarget info\n";
+ exit(1);
+ }
// FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
// MCObjectFileInfo needs a MCContext reference in order to initialize itself.