From dcf1f8e7169285486d00409484a2a9b0ee14eb6d Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Fri, 9 Nov 2018 18:03:21 +0000 Subject: [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 --- llvm/tools/llvm-strings/llvm-strings.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/tools/llvm-strings/llvm-strings.cpp') 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(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(); -- cgit v1.2.3