blob: e0701f7f4cc6d36c36f48a2f38c38c172d6d69fc [file] [log] [blame]
Rafael Espindola192e1fa2015-08-06 15:08:23 +00001//===- 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
15namespace lld {
16namespace elf2 {
17
Rui Ueyamad5b5ab72015-09-24 18:55:33 +000018void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; }
19
Rafael Espindola192e1fa2015-08-06 15:08:23 +000020void error(const Twine &Msg) {
21 llvm::errs() << Msg << "\n";
22 exit(1);
23}
24
25void error(std::error_code EC, const Twine &Prefix) {
26 if (!EC)
27 return;
28 error(Prefix + ": " + EC.message());
29}
30
31void error(std::error_code EC) {
32 if (!EC)
33 return;
34 error(EC.message());
35}
36
37} // namespace elf2
38} // namespace lld