summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/MC/MCInst.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lib/MC/MCInst.cpp')
-rw-r--r--gnu/llvm/lib/MC/MCInst.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/gnu/llvm/lib/MC/MCInst.cpp b/gnu/llvm/lib/MC/MCInst.cpp
index f9b71caaf91..64f111fc711 100644
--- a/gnu/llvm/lib/MC/MCInst.cpp
+++ b/gnu/llvm/lib/MC/MCInst.cpp
@@ -72,11 +72,17 @@ void MCInst::print(raw_ostream &OS) const {
void MCInst::dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer,
StringRef Separator) const {
+ StringRef InstName = Printer ? Printer->getOpcodeName(getOpcode()) : "";
+ dump_pretty(OS, InstName, Separator);
+}
+
+void MCInst::dump_pretty(raw_ostream &OS, StringRef Name,
+ StringRef Separator) const {
OS << "<MCInst #" << getOpcode();
- // Show the instruction opcode name if we have access to a printer.
- if (Printer)
- OS << ' ' << Printer->getOpcodeName(getOpcode());
+ // Show the instruction opcode name if we have it.
+ if (!Name.empty())
+ OS << ' ' << Name;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
OS << Separator;