[llvm] r339404 - [llvm-objcopy] NFC: Add some color to error()
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 9 15:52:03 PDT 2018
Author: rupprecht
Date: Thu Aug 9 15:52:03 2018
New Revision: 339404
URL: http://llvm.org/viewvc/llvm-project?rev=339404&view=rev
Log:
[llvm-objcopy] NFC: Add some color to error()
Modified:
llvm/trunk/test/tools/llvm-objcopy/strip-group-symbol.test
llvm/trunk/test/tools/llvm-objcopy/strip-reloc-symbol.test
llvm/trunk/tools/llvm-objcopy/Object.cpp
llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
Modified: llvm/trunk/test/tools/llvm-objcopy/strip-group-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-group-symbol.test?rev=339404&r1=339403&r2=339404&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/strip-group-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/strip-group-symbol.test Thu Aug 9 15:52:03 2018
@@ -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].
Modified: llvm/trunk/test/tools/llvm-objcopy/strip-reloc-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-reloc-symbol.test?rev=339404&r1=339403&r2=339404&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/strip-reloc-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/strip-reloc-symbol.test Thu Aug 9 15:52:03 2018
@@ -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.
Modified: llvm/trunk/tools/llvm-objcopy/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.cpp?rev=339404&r1=339403&r2=339404&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.cpp Thu Aug 9 15:52:03 2018
@@ -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");
}
Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=339404&r1=339403&r2=339404&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Thu Aug 9 15:52:03 2018
@@ -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
raw_string_ostream OS(Buf);
logAllUnhandledErrors(std::move(E), OS, "");
OS.flush();
- errs() << ToolName << ": '" << File << "': " << Buf;
+ WithColor::error(errs(), ToolName) << "'" << File << "': " << Buf;
exit(1);
}
More information about the llvm-commits
mailing list