1 //===- Error.cpp ----------------------------------------------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 #include "llvm/ADT/Twine.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/Process.h"
15 #include "llvm/Support/raw_ostream.h"
17 #if !defined(_MSC_VER) && !defined(__MINGW32__)
26 void fatal(const Twine &Msg) {
27 if (sys::Process::StandardErrHasColors()) {
28 errs().changeColor(raw_ostream::RED, /*bold=*/true);
34 errs() << Msg << "\n";
41 void fatal(std::error_code EC, const Twine &Msg) {
42 fatal(Msg + ": " + EC.message());
45 void fatal(llvm::Error &Err, const Twine &Msg) {
46 fatal(errorToErrorCode(std::move(Err)), Msg);