diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/test/tools/llvm-cxxdump/trivial.test | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/llvm/test/tools/llvm-cxxdump/trivial.test b/llvm/test/tools/llvm-cxxdump/trivial.test index d4982b87d8d..8df0bc32e1e 100644 --- a/llvm/test/tools/llvm-cxxdump/trivial.test +++ b/llvm/test/tools/llvm-cxxdump/trivial.test @@ -63,4 +63,4 @@ ELF-I386-NEXT: _ZTV1A[8]: _ZN1A1fEv MIXEDARCOFF-I386: ??_7S@@6B@[0]: ??_R4S@@6B@ RUN: not llvm-cxxdump %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s -ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory +ENOENT: {{.*}}.blah: error: {{[Nn]}}o such file or directory diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp index 09e40d9b0db..40db5c933f0 100644 --- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp +++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/InitLLVM.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <string> @@ -43,17 +44,17 @@ namespace llvm { static void error(std::error_code EC) { if (!EC) return; - outs() << "\nError reading file: " << EC.message() << ".\n"; + WithColor::error(outs(), "") << "reading file: " << EC.message() << ".\n"; outs().flush(); exit(1); } static void error(Error Err) { - if (Err) { - logAllUnhandledErrors(std::move(Err), outs(), "Error reading file: "); - outs().flush(); - exit(1); - } + if (!Err) + return; + logAllUnhandledErrors(std::move(Err), WithColor::error(outs(), ""), "reading file: "); + outs().flush(); + exit(1); } } // namespace llvm @@ -61,7 +62,7 @@ static void error(Error Err) { static void reportError(StringRef Input, StringRef Message) { if (Input == "-") Input = "<stdin>"; - errs() << Input << ": " << Message << "\n"; + WithColor::error(errs(), Input) << Message << "\n"; errs().flush(); exit(1); } |