forked from OSchip/llvm-project
[not] Improve error reporting consistency.
Makes `not` use WithColor from Support so it prints 'error' in color when applicable. llvm-svn: 346460
This commit is contained in:
parent
eb98774299
commit
86ef28f1a2
|
|
@ -13,7 +13,9 @@
|
||||||
// Will return true if cmd crashes (e.g. for testing crash reporting).
|
// Will return true if cmd crashes (e.g. for testing crash reporting).
|
||||||
|
|
||||||
#include "llvm/Support/Program.h"
|
#include "llvm/Support/Program.h"
|
||||||
|
#include "llvm/Support/WithColor.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
int main(int argc, const char **argv) {
|
int main(int argc, const char **argv) {
|
||||||
|
|
@ -33,7 +35,7 @@ int main(int argc, const char **argv) {
|
||||||
|
|
||||||
auto Program = sys::findProgramByName(argv[0]);
|
auto Program = sys::findProgramByName(argv[0]);
|
||||||
if (!Program) {
|
if (!Program) {
|
||||||
errs() << "Error: Unable to find `" << argv[0]
|
WithColor::error() << "unable to find `" << argv[0]
|
||||||
<< "' in PATH: " << Program.getError().message() << "\n";
|
<< "' in PATH: " << Program.getError().message() << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +55,7 @@ int main(int argc, const char **argv) {
|
||||||
Result = -3;
|
Result = -3;
|
||||||
#endif
|
#endif
|
||||||
if (Result < 0) {
|
if (Result < 0) {
|
||||||
errs() << "Error: " << ErrMsg << "\n";
|
WithColor::error() << ErrMsg << "\n";
|
||||||
if (ExpectCrash)
|
if (ExpectCrash)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue