Skip to content

Commit cfa0947

Browse files
authored
Cope with MCOperand null Insts (#91794)
MCOperand has a constructor that permits a nullptr MCInst, and BOLT makes use of that. Adjust MCOperand's dumper to permit such use.
1 parent e1685eb commit cfa0947

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/MC/MCInst.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ void MCOperand::print(raw_ostream &OS, const MCRegisterInfo *RegInfo) const {
3838
OS << "Expr:(" << *getExpr() << ")";
3939
} else if (isInst()) {
4040
OS << "Inst:(";
41-
getInst()->print(OS, RegInfo);
41+
if (const auto *Inst = getInst())
42+
Inst->print(OS, RegInfo);
43+
else
44+
OS << "NULL";
4245
OS << ")";
4346
} else
4447
OS << "UNDEFINED";

0 commit comments

Comments
 (0)