diff options
| author | Fangrui Song <maskray@google.com> | 2019-07-12 04:51:31 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-07-12 04:51:31 +0000 |
| commit | 27ed1c5bb80c8da317cd80bdd50cb22189d1c6fb (patch) | |
| tree | fa9f57c557e4bbd583dff780ec9a1a5a3e00ea66 /llvm/unittests/TextAPI | |
| parent | 320d6795b29efee3f5d47e2c88dcd74d621e482f (diff) | |
| download | bcm5719-llvm-27ed1c5bb80c8da317cd80bdd50cb22189d1c6fb.tar.gz bcm5719-llvm-27ed1c5bb80c8da317cd80bdd50cb22189d1c6fb.zip | |
[YAMLIO] Remove trailing spaces when outputting maps
llvm::yaml::Output::paddedKey unconditionally outputs spaces, which
are superfluous if the value to be dumped is a sequence or map.
Change `bool NeedsNewLine` to `StringRef Padding` so that it can be
overridden to `\n` if the value is a sequence or map.
An empty map/sequence is special. It is printed as `{}` or `[]` without
a newline, while a non-empty map/sequence follows a newline. To handle
this distinction, add another variable `PaddingBeforeContainer` and does
the special handling in endMapping/endSequence.
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D64566
llvm-svn: 365869
Diffstat (limited to 'llvm/unittests/TextAPI')
| -rw-r--r-- | llvm/unittests/TextAPI/ELFYAMLTest.cpp | 4 | ||||
| -rw-r--r-- | llvm/unittests/TextAPI/TextStubV1Tests.cpp | 2 | ||||
| -rw-r--r-- | llvm/unittests/TextAPI/TextStubV2Tests.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/unittests/TextAPI/ELFYAMLTest.cpp b/llvm/unittests/TextAPI/ELFYAMLTest.cpp index 9c50a6bee50..8217507b5a5 100644 --- a/llvm/unittests/TextAPI/ELFYAMLTest.cpp +++ b/llvm/unittests/TextAPI/ELFYAMLTest.cpp @@ -149,7 +149,7 @@ TEST(ElfYamlTextAPI, YAMLWritesTBESymbols) { "--- !tapi-tbe\n" "TbeVersion: 1.0\n" "Arch: AArch64\n" - "Symbols: \n" + "Symbols:\n" " bar: { Type: Func, Weak: true }\n" " foo: { Type: NoType, Size: 99, Warning: Does nothing }\n" " nor: { Type: Func, Undefined: true }\n" @@ -205,7 +205,7 @@ TEST(ElfYamlTextAPI, YAMLWritesNoTBESyms) { "TbeVersion: 1.0\n" "SoName: nosyms.so\n" "Arch: x86_64\n" - "NeededLibs: \n" + "NeededLibs:\n" " - libc.so\n" " - libfoo.so\n" " - libbar.so\n" diff --git a/llvm/unittests/TextAPI/TextStubV1Tests.cpp b/llvm/unittests/TextAPI/TextStubV1Tests.cpp index 5ff15b9fb8d..165e58f09d5 100644 --- a/llvm/unittests/TextAPI/TextStubV1Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV1Tests.cpp @@ -159,7 +159,7 @@ TEST(TBDv1, WriteFile) { "compatibility-version: 0\n" "swift-version: 5\n" "objc-constraint: retain_release\n" - "exports: \n" + "exports:\n" " - archs: [ i386 ]\n" " symbols: [ _sym1 ]\n" " weak-def-symbols: [ _sym2 ]\n" diff --git a/llvm/unittests/TextAPI/TextStubV2Tests.cpp b/llvm/unittests/TextAPI/TextStubV2Tests.cpp index f380f7f362d..b4b8ca9b91e 100644 --- a/llvm/unittests/TextAPI/TextStubV2Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV2Tests.cpp @@ -182,7 +182,7 @@ TEST(TBDv2, WriteFile) { "current-version: 1.2.3\n" "compatibility-version: 0\n" "swift-version: 5\n" - "exports: \n" + "exports:\n" " - archs: [ i386 ]\n" " symbols: [ _sym1 ]\n" " weak-def-symbols: [ _sym2 ]\n" |

