mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[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
This commit is contained in:
parent
bc019cf120
commit
d649af9402
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user