summaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-20 11:41:25 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-20 11:41:25 +0000
commitd9484dd61cc151c4f34c31e07f693fefa66316b5 (patch)
treeab0560b3da293f1fafd3269c59692e929418f5c2 /contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
parent79e0962d4c3cf1f0acf359a9d69cb3ac68c414c4 (diff)
parentd8e91e46262bc44006913e6796843909f1ac7bcd (diff)
Notes
Diffstat (limited to 'contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp')
-rw-r--r--contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index 09e40d9b0db7..7594066a395d 100644
--- a/contrib/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/contrib/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,18 @@ 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 +63,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);
}
@@ -496,7 +498,7 @@ static void dumpArchive(const Archive *Arc) {
if (auto E = isNotObjectErrorInvalidFileType(ChildOrErr.takeError())) {
std::string Buf;
raw_string_ostream OS(Buf);
- logAllUnhandledErrors(std::move(E), OS, "");
+ logAllUnhandledErrors(std::move(E), OS);
OS.flush();
reportError(Arc->getFileName(), Buf);
}