From 344ea291484f6888cd31ba82bd7b8393ee006463 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 25 Feb 2015 22:46:38 +0000 Subject: [PATCH 1/1] IR: Drop newline from AssemblyWriter::printMDNodeBody() Remove a newline from `AssemblyWriter::printMDNodeBody()`, and add one to `AssemblyWriter::writeMDNode()`. NFCI for assembly output. However, this drops an inconsistent newline from `Metadata::print()` when `this` is an `MDNode`. Now the newline added by `Metadata::dump()` won't look so verbose. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230565 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/AsmWriter.cpp | 2 +- unittests/IR/MetadataTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index dccbfe47dd2..de0e614c876 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -3000,6 +3000,7 @@ static void WriteMDNodeComment(const MDNode *Node, void AssemblyWriter::writeMDNode(unsigned Slot, const MDNode *Node) { Out << '!' << Slot << " = "; printMDNodeBody(Node); + Out << "\n"; } void AssemblyWriter::writeAllMDNodes() { @@ -3017,7 +3018,6 @@ void AssemblyWriter::writeAllMDNodes() { void AssemblyWriter::printMDNodeBody(const MDNode *Node) { WriteMDNodeBodyInternal(Out, Node, &TypePrinter, &Machine, TheModule); WriteMDNodeComment(Node, Out); - Out << "\n"; } void AssemblyWriter::writeAllAttributeGroups() { diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp index 849616b6af3..6f2372d58cb 100644 --- a/unittests/IR/MetadataTest.cpp +++ b/unittests/IR/MetadataTest.cpp @@ -228,7 +228,7 @@ TEST_F(MDNodeTest, Print) { MDNode *Nodes[] = {N0, N1, N2}; for (auto *Node : Nodes) OS << ", <" << (void *)Node << ">"; - OS << "}\n"; + OS << "}"; } std::string Actual; -- 2.34.1