1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[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>.

llvm-svn: 191787
This commit is contained in:
Quentin Colombet 2013-10-01 19:21:24 +00:00
parent e06d79aa83
commit 713cf44d41

View File

@ -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;
}
}