[llvm] r346460 - [not] Improve error reporting consistency.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 8 17:17:22 PST 2018


Author: jdevlieghere
Date: Thu Nov  8 17:17:22 2018
New Revision: 346460

URL: http://llvm.org/viewvc/llvm-project?rev=346460&view=rev
Log:
[not] Improve error reporting consistency.

Makes `not` use WithColor from Support so it prints 'error' in color
when applicable.

Modified:
    llvm/trunk/utils/not/not.cpp

Modified: llvm/trunk/utils/not/not.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/not/not.cpp?rev=346460&r1=346459&r2=346460&view=diff
==============================================================================
--- llvm/trunk/utils/not/not.cpp (original)
+++ llvm/trunk/utils/not/not.cpp Thu Nov  8 17:17:22 2018
@@ -13,7 +13,9 @@
 //     Will return true if cmd crashes (e.g. for testing crash reporting).
 
 #include "llvm/Support/Program.h"
+#include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
+
 using namespace llvm;
 
 int main(int argc, const char **argv) {
@@ -33,8 +35,8 @@ int main(int argc, const char **argv) {
 
   auto Program = sys::findProgramByName(argv[0]);
   if (!Program) {
-    errs() << "Error: Unable to find `" << argv[0]
-           << "' in PATH: " << Program.getError().message() << "\n";
+    WithColor::error() << "unable to find `" << argv[0]
+                       << "' in PATH: " << Program.getError().message() << "\n";
     return 1;
   }
 
@@ -53,7 +55,7 @@ int main(int argc, const char **argv) {
     Result = -3;
 #endif
   if (Result < 0) {
-    errs() << "Error: " << ErrMsg << "\n";
+    WithColor::error() << ErrMsg << "\n";
     if (ExpectCrash)
       return 0;
     return 1;




More information about the llvm-commits mailing list