From d68f8db2e16ddc1af04b7568943c974762753c01 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sat, 23 Jun 2018 16:49:07 +0000 Subject: [PATCH] [llvm-mt] Use WithColor for printing errors. Use the WithColor helper from support to print errors. llvm-svn: 335416 --- test/tools/llvm-mt/conflicting.test | 2 +- test/tools/llvm-mt/help.test | 4 ++-- test/tools/llvm-mt/xml_error.test | 4 ++-- tools/llvm-mt/llvm-mt.cpp | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/tools/llvm-mt/conflicting.test b/test/tools/llvm-mt/conflicting.test index 9d69fec78e3..adcfd598f80 100644 --- a/test/tools/llvm-mt/conflicting.test +++ b/test/tools/llvm-mt/conflicting.test @@ -4,4 +4,4 @@ UNSUPPORTED: system-windows RUN: not llvm-mt /manifest %p/Inputs/test_manifest.manifest /manifest \ RUN: %p/Inputs/conflicting.manifest /out:%t 2>&1 >/dev/null | FileCheck %s -CHECK: llvm-mt error: conflicting attributes for requestedExecutionLevel +CHECK: llvm-mt: error: conflicting attributes for requestedExecutionLevel diff --git a/test/tools/llvm-mt/help.test b/test/tools/llvm-mt/help.test index e13066d2a0f..291e13cd4a2 100644 --- a/test/tools/llvm-mt/help.test +++ b/test/tools/llvm-mt/help.test @@ -3,8 +3,8 @@ RUN: llvm-mt /h | FileCheck %s -check-prefix=HELP HELP: OVERVIEW: Manifest Tool RUN: not llvm-mt /foo 2>&1 >/dev/null | FileCheck %s -check-prefix=INVALID -INVALID: llvm-mt error: invalid option '/foo' +INVALID: llvm-mt: error: invalid option '/foo' RUN: not llvm-mt /oyt:%t 2>&1 | FileCheck %s -check-prefix=INVALID-BUT-CLOSE -INVALID-BUT-CLOSE: llvm-mt error: invalid option '/oyt:{{.*}}help.test.tmp', did you mean '/out:{{.*}}help.test.tmp'? +INVALID-BUT-CLOSE: llvm-mt: error: invalid option '/oyt:{{.*}}help.test.tmp', did you mean '/out:{{.*}}help.test.tmp'? diff --git a/test/tools/llvm-mt/xml_error.test b/test/tools/llvm-mt/xml_error.test index a2b043023de..4d0a8ece43b 100644 --- a/test/tools/llvm-mt/xml_error.test +++ b/test/tools/llvm-mt/xml_error.test @@ -4,12 +4,12 @@ UNSUPPORTED: system-windows RUN: not llvm-mt /manifest %p/Inputs/bad.manifest 2>&1 >/dev/null | FileCheck \ RUN: %s -CHECK: llvm-mt error: invalid xml document +CHECK: llvm-mt: error: invalid xml document RUN: not llvm-mt /manifest %p/Inputs/empty.manifest 2>&1 >/dev/null | \ RUN: FileCheck %s -check-prefix=EMPTY -EMPTY: llvm-mt error: attempted to merge empty manifest +EMPTY: llvm-mt: error: attempted to merge empty manifest RUN: llvm-mt /inputresource:foo.res \ RUN: /manifest %p/Inputs/test_manifest.manifest \ diff --git a/tools/llvm-mt/llvm-mt.cpp b/tools/llvm-mt/llvm-mt.cpp index 41f7327e9c2..1339fd1572e 100644 --- a/tools/llvm-mt/llvm-mt.cpp +++ b/tools/llvm-mt/llvm-mt.cpp @@ -24,6 +24,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include "llvm/WindowsManifest/WindowsManifestMerger.h" @@ -65,7 +66,7 @@ public: } // namespace LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg) { - errs() << "llvm-mt error: " << Msg << "\n"; + WithColor::error(errs(), "llvm-mt") << Msg << '\n'; exit(1); }