From acf9f08861adfb00b3adec06999d015b2801268c Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 17 Sep 2025 09:22:46 +0900 Subject: [PATCH] llvm-ml: Error on MCSubtargetInfo construction failure Replace assert with an error. --- llvm/tools/llvm-ml/llvm-ml.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp index ae58b0da6d69b..cda86e77f3eb4 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 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.