Rafael Espindola | 192e1fa | 2015-08-06 15:08:23 +0000 | [diff] [blame] | 1 | //===- Error.cpp ----------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Linker |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "Error.h" |
| 11 | |
| 12 | #include "llvm/ADT/Twine.h" |
| 13 | #include "llvm/Support/raw_ostream.h" |
| 14 | |
| 15 | namespace lld { |
| 16 | namespace elf2 { |
| 17 | |
Rui Ueyama | d5b5ab7 | 2015-09-24 18:55:33 +0000 | [diff] [blame^] | 18 | void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; } |
| 19 | |
Rafael Espindola | 192e1fa | 2015-08-06 15:08:23 +0000 | [diff] [blame] | 20 | void error(const Twine &Msg) { |
| 21 | llvm::errs() << Msg << "\n"; |
| 22 | exit(1); |
| 23 | } |
| 24 | |
| 25 | void error(std::error_code EC, const Twine &Prefix) { |
| 26 | if (!EC) |
| 27 | return; |
| 28 | error(Prefix + ": " + EC.message()); |
| 29 | } |
| 30 | |
| 31 | void error(std::error_code EC) { |
| 32 | if (!EC) |
| 33 | return; |
| 34 | error(EC.message()); |
| 35 | } |
| 36 | |
| 37 | } // namespace elf2 |
| 38 | } // namespace lld |