1 //===- Error.cpp ----------------------------------------------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 #include "llvm/ADT/Twine.h"
14 #include "llvm/Support/Error.h"
15 #include "llvm/Support/raw_ostream.h"
25 void log(const Twine &Msg) {
27 outs() << Msg << "\n";
30 void warning(const Twine &Msg) {
31 if (Config->FatalWarnings)
34 *ErrorOS << Msg << "\n";
37 void error(const Twine &Msg) {
38 *ErrorOS << Msg << "\n";
42 void error(std::error_code EC, const Twine &Prefix) {
43 error(Prefix + ": " + EC.message());
46 void fatal(const Twine &Msg) {
47 *ErrorOS << Msg << "\n";
51 void fatal(const Twine &Msg, const Twine &Prefix) {
52 fatal(Prefix + ": " + Msg);
55 void check(std::error_code EC) {
60 void check(Error Err) {
61 check(errorToErrorCode(std::move(Err)));