Skip to content

Commit a57c583

Browse files
authored
llvm-ml: Error on MCSubtargetInfo construction failure (#159221)
Replace assert with an error.
1 parent 7dc7d0e commit a57c583

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/tools/llvm-ml/llvm-ml.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ int llvm_ml_main(int Argc, char **Argv, const llvm::ToolContext &) {
325325

326326
std::unique_ptr<MCSubtargetInfo> STI(
327327
TheTarget->createMCSubtargetInfo(TheTriple, /*CPU=*/"", /*Features=*/""));
328-
assert(STI && "Unable to create subtarget info!");
328+
if (!STI) {
329+
WithColor::error(errs(), ProgName) << "unable to create subtarget info\n";
330+
exit(1);
331+
}
329332

330333
// FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
331334
// MCObjectFileInfo needs a MCContext reference in order to initialize itself.

0 commit comments

Comments
 (0)