forked from OSchip/llvm-project
[llvm-objcopy] NFC: Add some color to error()
llvm-svn: 339404
This commit is contained in:
parent
40922db37c
commit
88ed5e59bd
|
@ -28,4 +28,4 @@ Symbols:
|
|||
Type: STT_FUNC
|
||||
Section: .text
|
||||
|
||||
#CHECK: {{.*}}llvm-objcopy{{(\.EXE|\.exe)?}}: Symbol foo cannot be removed because it is referenced by the section .group[1].
|
||||
#CHECK: Symbol foo cannot be removed because it is referenced by the section .group[1].
|
||||
|
|
|
@ -29,4 +29,4 @@ Symbols:
|
|||
Value: 0x1000
|
||||
Size: 8
|
||||
|
||||
#CHECK: {{.*}}llvm-objcopy{{(\.EXE|\.exe)?}}: not stripping symbol `foo' because it is named in a relocation.
|
||||
#CHECK: not stripping symbol 'foo' because it is named in a relocation.
|
||||
|
|
|
@ -433,7 +433,7 @@ void RelocationSection::removeSymbols(
|
|||
function_ref<bool(const Symbol &)> ToRemove) {
|
||||
for (const Relocation &Reloc : Relocations)
|
||||
if (ToRemove(*Reloc.RelocSymbol))
|
||||
error("not stripping symbol `" + Reloc.RelocSymbol->Name +
|
||||
error("not stripping symbol '" + Reloc.RelocSymbol->Name +
|
||||
"' because it is named in a relocation");
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm-objcopy.h"
|
||||
|
||||
#include "Object.h"
|
||||
#include "llvm/ADT/BitmaskEnum.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
|
@ -34,6 +35,7 @@
|
|||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/InitLLVM.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
@ -189,14 +191,15 @@ namespace objcopy {
|
|||
StringRef ToolName;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void error(Twine Message) {
|
||||
errs() << ToolName << ": " << Message << ".\n";
|
||||
WithColor::error(errs(), ToolName) << Message << ".\n";
|
||||
errs().flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, std::error_code EC) {
|
||||
assert(EC);
|
||||
errs() << ToolName << ": '" << File << "': " << EC.message() << ".\n";
|
||||
WithColor::error(errs(), ToolName)
|
||||
<< "'" << File << "': " << EC.message() << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -206,7 +209,7 @@ LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, Error E) {
|
|||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
OS.flush();
|
||||
errs() << ToolName << ": '" << File << "': " << Buf;
|
||||
WithColor::error(errs(), ToolName) << "'" << File << "': " << Buf;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue