1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[llvm-nm] Tidy up error messages

This adds colons to separate the file name from the message, removes a
duplicate space, and removes a trailing full stop from some messages.
These help bring the error messages into line with other tools, as well
as making all llvm-nm message more self-consistent.

Differential Revision: https://reviews.llvm.org/D96601

Reviewed by: Higuoxing, rupprecht, MaskRay
This commit is contained in:
James Henderson 2021-02-12 14:18:21 +00:00
parent ca7bdb7c29
commit a9c28d33d4
7 changed files with 13 additions and 13 deletions

View File

@ -108,7 +108,7 @@ RUN: not llvm-objdump --macho --private-headers %p/Inputs/macho-invalid-segment-
INVALID-SEGMENT-FILEOFF: macho-invalid-segment-fileoff': truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file) INVALID-SEGMENT-FILEOFF: macho-invalid-segment-fileoff': truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)
RUN: not llvm-nm %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-NM %s RUN: not llvm-nm %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-NM %s
INVALID-SEGMENT-FILEOFF-NM: macho-invalid-segment-fileoff truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file) INVALID-SEGMENT-FILEOFF-NM: macho-invalid-segment-fileoff: truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)
RUN: not llvm-size %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -DFILE=%p/Inputs/macho-invalid-segment-fileoff -check-prefix INVALID-SEGMENT-FILEOFF-SIZE %s RUN: not llvm-size %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -DFILE=%p/Inputs/macho-invalid-segment-fileoff -check-prefix INVALID-SEGMENT-FILEOFF-SIZE %s
INVALID-SEGMENT-FILEOFF-SIZE: error: '[[FILE]]': truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file) INVALID-SEGMENT-FILEOFF-SIZE: error: '[[FILE]]': truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)

View File

@ -58,7 +58,7 @@ GNU AR is able to parse the unaligned member and warns about the member with
the unknown format. We should probably simply warn on both. For now we just the unknown format. We should probably simply warn on both. For now we just
produce an error for the unknown format. produce an error for the unknown format.
RUN: not llvm-nm %p/Inputs/corrupt-archive.a 2>&1 | FileCheck %s -check-prefix CORRUPT RUN: not llvm-nm %p/Inputs/corrupt-archive.a 2>&1 | FileCheck %s -check-prefix CORRUPT
CORRUPT: corrupt-archive.a(trivial-object-test2.elf-x86-64) Insufficient alignment CORRUPT: corrupt-archive.a(trivial-object-test2.elf-x86-64): Insufficient alignment
RUN: llvm-nm %p/Inputs/thin.a | FileCheck %s -check-prefix THIN RUN: llvm-nm %p/Inputs/thin.a | FileCheck %s -check-prefix THIN

View File

@ -32,7 +32,7 @@
# RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \ # RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
# RUN: | FileCheck %s -check-prefix ERROR # RUN: | FileCheck %s -check-prefix ERROR
# ERROR: File format has no dynamic symbol table. # ERROR: File format has no dynamic symbol table
# RUN: yaml2obj %s -o %t.elf-i386 # RUN: yaml2obj %s -o %t.elf-i386
# RUN: llvm-nm -D %t.elf-i386 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS # RUN: llvm-nm -D %t.elf-i386 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS

View File

@ -8,13 +8,13 @@ RUN: not llvm-nm %p/Inputs/tapi-invalid-v3.tbd 2>&1\
RUN: | FileCheck %s -check-prefix V3 RUN: | FileCheck %s -check-prefix V3
# Typo Check # Typo Check
V1: tapi-invalid-v1.tbd malformed file V1: tapi-invalid-v1.tbd: malformed file
V1-NEXT: tapi-invalid-v1.tbd:11:1: error: unknown key 'expors' V1-NEXT: tapi-invalid-v1.tbd:11:1: error: unknown key 'expors'
# Missing required key # Missing required key
V2: tapi-invalid-v2.tbd malformed file V2: tapi-invalid-v2.tbd: malformed file
V2-NEXT: tapi-invalid-v2.tbd:2:1: error: missing required key 'archs' V2-NEXT: tapi-invalid-v2.tbd:2:1: error: missing required key 'archs'
# v2 key in v3 specified file # v2 key in v3 specified file
V3: tapi-invalid-v3.tbd malformed file V3: tapi-invalid-v3.tbd: malformed file
V3-NEXT: tapi-invalid-v3.tbd:19:1: error: unknown key 'swift-version' V3-NEXT: tapi-invalid-v3.tbd:19:1: error: unknown key 'swift-version'

View File

@ -190,4 +190,4 @@ DynamicSymbols:
# RUN: FileCheck %s -DFILE=%t4-broken-dynsym.o --check-prefix=VERSION-ERR4 # RUN: FileCheck %s -DFILE=%t4-broken-dynsym.o --check-prefix=VERSION-ERR4
# VERSION-ERR4: warning: unable to read symbol versions: unable to read flags for symbol with index 1: section [index 4] has invalid sh_entsize: expected 24, but got 255 # VERSION-ERR4: warning: unable to read symbol versions: unable to read flags for symbol with index 1: section [index 4] has invalid sh_entsize: expected 24, but got 255
# VERSION-ERR4: error: [[FILE]] section [index 4] has invalid sh_entsize: expected 24, but got 255 # VERSION-ERR4: error: [[FILE]]: section [index 4] has invalid sh_entsize: expected 24, but got 255

View File

@ -1,2 +1,2 @@
RUN: not llvm-nm %s 2>&1 | FileCheck %s -check-prefix=UNKNOWN_FILE_TYPE RUN: not llvm-nm %s 2>&1 | FileCheck %s -check-prefix=UNKNOWN_FILE_TYPE
UNKNOWN_FILE_TYPE: {{.*}}invalid-input.test The file was not recognized as a valid object file UNKNOWN_FILE_TYPE: {{.*}}invalid-input.test: The file was not recognized as a valid object file

View File

@ -232,7 +232,7 @@ std::string ToolName;
static void error(Twine Message, Twine Path = Twine()) { static void error(Twine Message, Twine Path = Twine()) {
HadError = true; HadError = true;
WithColor::error(errs(), ToolName) << Path << ": " << Message << ".\n"; WithColor::error(errs(), ToolName) << Path << ": " << Message << "\n";
} }
static bool error(std::error_code EC, Twine Path = Twine()) { static bool error(std::error_code EC, Twine Path = Twine()) {
@ -262,13 +262,13 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C,
errs() << "(" << NameOrErr.get() << ")"; errs() << "(" << NameOrErr.get() << ")";
if (!ArchitectureName.empty()) if (!ArchitectureName.empty())
errs() << " (for architecture " << ArchitectureName << ") "; errs() << " (for architecture " << ArchitectureName << ")";
std::string Buf; std::string Buf;
raw_string_ostream OS(Buf); raw_string_ostream OS(Buf);
logAllUnhandledErrors(std::move(E), OS); logAllUnhandledErrors(std::move(E), OS);
OS.flush(); OS.flush();
errs() << " " << Buf << "\n"; errs() << ": " << Buf << "\n";
} }
// This version of error() prints the file name and which architecture slice it // This version of error() prints the file name and which architecture slice it
@ -281,13 +281,13 @@ static void error(llvm::Error E, StringRef FileName,
WithColor::error(errs(), ToolName) << FileName; WithColor::error(errs(), ToolName) << FileName;
if (!ArchitectureName.empty()) if (!ArchitectureName.empty())
errs() << " (for architecture " << ArchitectureName << ") "; errs() << " (for architecture " << ArchitectureName << ")";
std::string Buf; std::string Buf;
raw_string_ostream OS(Buf); raw_string_ostream OS(Buf);
logAllUnhandledErrors(std::move(E), OS); logAllUnhandledErrors(std::move(E), OS);
OS.flush(); OS.flush();
errs() << " " << Buf << "\n"; errs() << ": " << Buf << "\n";
} }
namespace { namespace {