[llvm] r191787 - [MC] When MCInstPrint::printAnnotation uses a comment stream, it has to ensure
Quentin Colombet
qcolombet at apple.com
Tue Oct 1 12:21:25 PDT 2013
Author: qcolombet
Date: Tue Oct 1 14:21:24 2013
New Revision: 191787
URL: http://llvm.org/viewvc/llvm-project?rev=191787&view=rev
Log:
[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>.
Modified:
llvm/trunk/lib/MC/MCInstPrinter.cpp
Modified: llvm/trunk/lib/MC/MCInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCInstPrinter.cpp?rev=191787&r1=191786&r2=191787&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCInstPrinter.cpp (original)
+++ llvm/trunk/lib/MC/MCInstPrinter.cpp Tue Oct 1 14:21:24 2013
@@ -31,9 +31,13 @@ void MCInstPrinter::printRegName(raw_ost
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;
}
}
More information about the llvm-commits
mailing list