summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cxxdump
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-11-11 01:24:02 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-11-11 01:24:02 +0000
commited75efa5cdcb74432286bdf9a859e2c2f058269b (patch)
treee4aa729926efbab85e578818b946c2668fd0f555 /llvm/tools/llvm-cxxdump
parent64a26308256adcf9212fd346733a60735f7acc01 (diff)
downloadbcm5719-llvm-ed75efa5cdcb74432286bdf9a859e2c2f058269b.tar.gz
bcm5719-llvm-ed75efa5cdcb74432286bdf9a859e2c2f058269b.zip
[llvm-cxxdump] Use error reporting helpers from support
This patch makes llvm-cxxdump use the error reporting helpers from Support/WithColor.h llvm-svn: 346602
Diffstat (limited to 'llvm/tools/llvm-cxxdump')
-rw-r--r--llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp15
1 files changed, 8 insertions, 7 deletions
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);
}
OpenPOWER on IntegriCloud