Skip to content

Commit 521bc6e

Browse files
committed
[YAML] fix output incorrect format for block scalar string
1 parent 8a85976 commit 521bc6e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Support/YAMLTraits.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,18 +725,18 @@ void Output::blockScalarString(StringRef &S) {
725725
if (!StateStack.empty())
726726
newLineCheck();
727727
output(" |");
728-
outputNewLine();
729728

730729
unsigned Indent = StateStack.empty() ? 1 : StateStack.size();
731730

732731
auto Buffer = MemoryBuffer::getMemBuffer(S, "", false);
733732
for (line_iterator Lines(*Buffer, false); !Lines.is_at_end(); ++Lines) {
733+
outputNewLine();
734734
for (unsigned I = 0; I < Indent; ++I) {
735735
output(" ");
736736
}
737737
output(*Lines);
738-
outputNewLine();
739738
}
739+
outputUpToEndOfLine("");
740740
}
741741

742742
void Output::scalarTag(std::string &Tag) {

llvm/unittests/Support/YAMLIOTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ TEST(YAMLIO, TestScalarAfterBlockScalar) {
12981298
- block_scalac: |
12991299
AA
13001300
BB
1301-
scalar: a
1301+
scalar: a
13021302
...
13031303
)");
13041304
}

0 commit comments

Comments
 (0)