From db3de106376558c7425d557b1b980f631107cd14 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Tue, 1 Oct 2013 19:21:24 +0000 Subject: [PATCH] [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 . git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191787 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCInstPrinter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/MC/MCInstPrinter.cpp b/lib/MC/MCInstPrinter.cpp index 6a452c8d4a7..ba71245d018 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; } } -- 2.34.1