From bd2a812ff028ef7ac2daa8ec6a8aaa80cb9b7e93 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 29 Nov 2016 04:09:08 +0000 Subject: [PATCH] Print error message header in red. llvm-svn: 288110 --- lld/COFF/Error.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lld/COFF/Error.cpp b/lld/COFF/Error.cpp index 602a854..80ca842 100644 --- a/lld/COFF/Error.cpp +++ b/lld/COFF/Error.cpp @@ -11,13 +11,24 @@ #include "llvm/ADT/Twine.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" +using namespace llvm; + namespace lld { namespace coff { void fatal(const Twine &Msg) { - llvm::errs() << Msg << "\n"; + if (sys::Process::StandardErrHasColors()) { + errs().changeColor(raw_ostream::RED, /*bold=*/true); + errs() << "error: "; + errs().resetColor(); + } else { + errs() << "error: "; + } + + errs() << Msg << "\n"; exit(1); } -- 2.7.4