diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2018-11-09 18:03:21 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2018-11-09 18:03:21 +0000 |
commit | dcf1f8e7169285486d00409484a2a9b0ee14eb6d (patch) | |
tree | f38edb7b09e8cfcd931140c6213025de5d760156 /llvm/tools/llvm-strings/llvm-strings.cpp | |
parent | 13d3371e687a44b4fd2d19107c95efdb3da9088c (diff) | |
download | bcm5719-llvm-dcf1f8e7169285486d00409484a2a9b0ee14eb6d.tar.gz bcm5719-llvm-dcf1f8e7169285486d00409484a2a9b0ee14eb6d.zip |
[llvm-strings] Fix whitespaces to match strings output.
Summary:
The current implementation prepends a space on every line, making it difficult to compare against GNU strings.
The space appears to have come from handling --radix in rL292707. The space is for making sure there's a space between the radix and the value; however the space is still emitted even when there is no radix. This change fixes that so the space is only emitted when there is a radix.
Reviewers: jhenderson
Reviewed By: jhenderson
Subscribers: llvm-commits, compnerd
Differential Revision: https://reviews.llvm.org/D54238
llvm-svn: 346529
Diffstat (limited to 'llvm/tools/llvm-strings/llvm-strings.cpp')
-rw-r--r-- | llvm/tools/llvm-strings/llvm-strings.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/tools/llvm-strings/llvm-strings.cpp b/llvm/tools/llvm-strings/llvm-strings.cpp index c355caf899d..cdc2a6ef033 100644 --- a/llvm/tools/llvm-strings/llvm-strings.cpp +++ b/llvm/tools/llvm-strings/llvm-strings.cpp @@ -60,21 +60,21 @@ static void strings(raw_ostream &OS, StringRef FileName, StringRef Contents) { if (L.size() < static_cast<size_t>(MinLength)) return; if (PrintFileName) - OS << FileName << ":"; + OS << FileName << ": "; switch (Radix) { case none: break; case octal: - OS << format("%8o", Offset); + OS << format("%7o ", Offset); break; case hexadecimal: - OS << format("%8x", Offset); + OS << format("%7x ", Offset); break; case decimal: - OS << format("%8u", Offset); + OS << format("%7u ", Offset); break; } - OS << " " << L << '\n'; + OS << L << '\n'; }; const char *B = Contents.begin(); |