From d93e1dfac8711cfed1a9d9cd1876a788b83945cd Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:19:15 +0000 Subject: Vendor import of lld trunk r290819: https://llvm.org/svn/llvm-project/lld/trunk@290819 --- COFF/Error.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'COFF/Error.cpp') diff --git a/COFF/Error.cpp b/COFF/Error.cpp index 602a8544ce2b..b2bd557413df 100644 --- a/COFF/Error.cpp +++ b/COFF/Error.cpp @@ -11,14 +11,31 @@ #include "llvm/ADT/Twine.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" +#if !defined(_MSC_VER) && !defined(__MINGW32__) +#include +#endif + +using namespace llvm; + namespace lld { namespace coff { void fatal(const Twine &Msg) { - llvm::errs() << Msg << "\n"; - exit(1); + if (sys::Process::StandardErrHasColors()) { + errs().changeColor(raw_ostream::RED, /*bold=*/true); + errs() << "error: "; + errs().resetColor(); + } else { + errs() << "error: "; + } + errs() << Msg << "\n"; + + outs().flush(); + errs().flush(); + _exit(1); } void fatal(std::error_code EC, const Twine &Msg) { -- cgit v1.3