In the disassembler C API, be careful not to confuse the comment streamer that the disassembler outputs annotations on with the streamer that the InstPrinter will print them on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140217 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCInstPrinter.cpp b/lib/MC/MCInstPrinter.cpp
index e15e107..5dbd4b0 100644
--- a/lib/MC/MCInstPrinter.cpp
+++ b/lib/MC/MCInstPrinter.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCInstPrinter.h"
+#include "llvm/MC/MCAsmInfo.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -26,5 +27,10 @@
}
void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) {
- if (!Annot.empty()) OS << Annot << "\n";
+ if (!Annot.empty()) {
+ if (CommentStream)
+ (*CommentStream) << Annot << "\n";
+ else
+ OS << " " << MAI.getCommentString() << " " << Annot << "\n";
+ }
}