Skip to content

Commit be6129a

Browse files
authored
llvm-exegesis: Error on MCSubtargetInfo construction failure (#159223)
1 parent ef45c97 commit be6129a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/tools/llvm-exegesis/lib/LlvmState.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ Expected<LLVMState> LLVMState::Create(std::string TripleName,
5656

5757
std::unique_ptr<MCSubtargetInfo> STI(
5858
TheTarget->createMCSubtargetInfo(TheTriple, CpuName, ""));
59+
if (!STI) {
60+
return make_error<StringError>("unable to create subtarget info",
61+
inconvertibleErrorCode());
62+
}
63+
5964
assert(STI && "Unable to create subtarget info!");
6065
if (!STI->isCPUStringValid(CpuName)) {
6166
return make_error<StringError>(Twine("invalid CPU name (")

0 commit comments

Comments
 (0)