Index: test/tools/llvm-strings/file-filename.test =================================================================== --- test/tools/llvm-strings/file-filename.test +++ test/tools/llvm-strings/file-filename.test @@ -1,3 +1,3 @@ RUN: llvm-strings -f %S/Inputs/abcd | FileCheck %s -RUN: llvm-strings --print-file-name %S/Inputs/abcd | FileCheck %s +RUN: llvm-strings --print-file-name %S/Inputs/abcd | FileCheck %s --strict-whitespace CHECK: {{[\\/]}}abcd: abcd Index: test/tools/llvm-strings/negative-char.test =================================================================== --- test/tools/llvm-strings/negative-char.test +++ test/tools/llvm-strings/negative-char.test @@ -1,3 +1,3 @@ # RUN: echo -e "z\0\x80\0a\0" | llvm-strings --bytes 1 - | FileCheck %s # CHECK: z{{$}} -# CHECK-NEXT: {{^}} a +# CHECK-NEXT: {{^}}a Index: test/tools/llvm-strings/radix-filename.test =================================================================== --- /dev/null +++ test/tools/llvm-strings/radix-filename.test @@ -0,0 +1,36 @@ +RUN: llvm-strings --print-file-name %S/Inputs/numbers \ +RUN: | FileCheck %s --check-prefix CHECK-NONE +RUN: llvm-strings --print-file-name -t d %S/Inputs/numbers \ +RUN: | FileCheck %s --check-prefix CHECK-DEC --strict-whitespace +RUN: llvm-strings --print-file-name -t o %S/Inputs/numbers \ +RUN: | FileCheck %s --check-prefix CHECK-OCT --strict-whitespace +RUN: llvm-strings --print-file-name -t x %S/Inputs/numbers \ +RUN: | FileCheck %s --check-prefix CHECK-HEX --strict-whitespace + +CHECK-NONE: numbers: three +CHECK-NONE: numbers: four +CHECK-NONE: numbers: five +CHECK-NONE: numbers: seven +CHECK-NONE: numbers: eight +CHECK-NONE: numbers: nine + +CHECK-DEC: numbers: 8 three +CHECK-DEC: numbers: 14 four +CHECK-DEC: numbers: 19 five +CHECK-DEC: numbers: 28 seven +CHECK-DEC: numbers: 34 eight +CHECK-DEC: numbers: 40 nine + +CHECK-OCT: numbers: 10 three +CHECK-OCT: numbers: 16 four +CHECK-OCT: numbers: 23 five +CHECK-OCT: numbers: 34 seven +CHECK-OCT: numbers: 42 eight +CHECK-OCT: numbers: 50 nine + +CHECK-HEX: numbers: 8 three +CHECK-HEX: numbers: e four +CHECK-HEX: numbers: 13 five +CHECK-HEX: numbers: 1c seven +CHECK-HEX: numbers: 22 eight +CHECK-HEX: numbers: 28 nine Index: test/tools/llvm-strings/radix.test =================================================================== --- test/tools/llvm-strings/radix.test +++ test/tools/llvm-strings/radix.test @@ -1,33 +1,32 @@ RUN: llvm-strings %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-NONE -RUN: llvm-strings -t d %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-DEC -RUN: llvm-strings -t o %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-OCT -RUN: llvm-strings -t x %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-HEX +RUN: llvm-strings -t d %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-DEC --strict-whitespace +RUN: llvm-strings -t o %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-OCT --strict-whitespace +RUN: llvm-strings -t x %S/Inputs/numbers | FileCheck %s -check-prefix CHECK-HEX --strict-whitespace -CHECK-NONE: three -CHECK-NONE: four -CHECK-NONE: five -CHECK-NONE: seven -CHECK-NONE: eight -CHECK-NONE: nine +CHECK-NONE: {{^}}three +CHECK-NONE: {{^}}four +CHECK-NONE: {{^}}five +CHECK-NONE: {{^}}seven +CHECK-NONE: {{^}}eight +CHECK-NONE: {{^}}nine -CHECK-DEC: 8 three -CHECK-DEC: 14 four -CHECK-DEC: 19 five -CHECK-DEC: 28 seven -CHECK-DEC: 34 eight -CHECK-DEC: 40 nine +CHECK-DEC: {{^}} 8 three +CHECK-DEC: {{^}} 14 four +CHECK-DEC: {{^}} 19 five +CHECK-DEC: {{^}} 28 seven +CHECK-DEC: {{^}} 34 eight +CHECK-DEC: {{^}} 40 nine -CHECK-OCT: 10 three -CHECK-OCT: 16 four -CHECK-OCT: 23 five -CHECK-OCT: 34 seven -CHECK-OCT: 42 eight -CHECK-OCT: 50 nine - -CHECK-HEX: 8 three -CHECK-HEX: e four -CHECK-HEX: 13 five -CHECK-HEX: 1c seven -CHECK-HEX: 22 eight -CHECK-HEX: 28 nine +CHECK-OCT: {{^}} 10 three +CHECK-OCT: {{^}} 16 four +CHECK-OCT: {{^}} 23 five +CHECK-OCT: {{^}} 34 seven +CHECK-OCT: {{^}} 42 eight +CHECK-OCT: {{^}} 50 nine +CHECK-HEX: {{^}} 8 three +CHECK-HEX: {{^}} e four +CHECK-HEX: {{^}} 13 five +CHECK-HEX: {{^}} 1c seven +CHECK-HEX: {{^}} 22 eight +CHECK-HEX: {{^}} 28 nine Index: test/tools/llvm-strings/whitespace.test =================================================================== --- /dev/null +++ test/tools/llvm-strings/whitespace.test @@ -0,0 +1,2 @@ +RUN: echo -n abcd | llvm-strings - | FileCheck %s --strict-whitespace +CHECK: {{^}}abcd{{$}} Index: tools/llvm-strings/llvm-strings.cpp =================================================================== --- tools/llvm-strings/llvm-strings.cpp +++ tools/llvm-strings/llvm-strings.cpp @@ -60,21 +60,21 @@ 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();