summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2013-10-01 19:21:24 +0000
committerQuentin Colombet <qcolombet@apple.com>2013-10-01 19:21:24 +0000
commitdb3de106376558c7425d557b1b980f631107cd14 (patch)
tree931de7d6f8126af8a3674f08720d2a766825f9de /lib/MC
parent187c774a7650e4bbbaac175cb6509f709edba593 (diff)
downloadllvm-db3de106376558c7425d557b1b980f631107cd14.tar.gz
llvm-db3de106376558c7425d557b1b980f631107cd14.tar.bz2
llvm-db3de106376558c7425d557b1b980f631107cd14.tar.xz
[MC] When MCInstPrint::printAnnotation uses a comment stream, it has to ensure
that each comment ends with a newline to match the definition in the header file. This is part of <rdar://problem/14687488>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCInstPrinter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/MC/MCInstPrinter.cpp b/lib/MC/MCInstPrinter.cpp
index 6a452c8d4a..ba71245d01 100644
--- a/lib/MC/MCInstPrinter.cpp
+++ b/lib/MC/MCInstPrinter.cpp
@@ -31,9 +31,13 @@ void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) {
if (!Annot.empty()) {
- if (CommentStream)
+ if (CommentStream) {
(*CommentStream) << Annot;
- else
+ // By definition (see MCInstPrinter.h), CommentStream must end with
+ // a newline after each comment.
+ if (Annot.back() != '\n')
+ (*CommentStream) << '\n';
+ } else
OS << " " << MAI.getCommentString() << " " << Annot;
}
}