diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 28642e004c4f4..035828b594e84 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -725,18 +725,18 @@ void Output::blockScalarString(StringRef &S) { if (!StateStack.empty()) newLineCheck(); output(" |"); - outputNewLine(); unsigned Indent = StateStack.empty() ? 1 : StateStack.size(); auto Buffer = MemoryBuffer::getMemBuffer(S, "", false); for (line_iterator Lines(*Buffer, false); !Lines.is_at_end(); ++Lines) { + outputNewLine(); for (unsigned I = 0; I < Indent; ++I) { output(" "); } output(*Lines); - outputNewLine(); } + outputUpToEndOfLine(""); } void Output::scalarTag(std::string &Tag) { diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp index 3db1db57ad596..5a86555d08fb3 100644 --- a/llvm/unittests/Support/YAMLIOTest.cpp +++ b/llvm/unittests/Support/YAMLIOTest.cpp @@ -1298,7 +1298,7 @@ TEST(YAMLIO, TestScalarAfterBlockScalar) { - block_scalac: | AA BB -scalar: a + scalar: a ... )"); }