diff options
Diffstat (limited to 'ELF/Error.cpp')
| -rw-r--r-- | ELF/Error.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ELF/Error.cpp b/ELF/Error.cpp new file mode 100644 index 000000000000..e0701f7f4cc6 --- /dev/null +++ b/ELF/Error.cpp @@ -0,0 +1,38 @@ +//===- Error.cpp ----------------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "Error.h" + +#include "llvm/ADT/Twine.h" +#include "llvm/Support/raw_ostream.h" + +namespace lld { +namespace elf2 { + +void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; } + +void error(const Twine &Msg) { + llvm::errs() << Msg << "\n"; + exit(1); +} + +void error(std::error_code EC, const Twine &Prefix) { + if (!EC) + return; + error(Prefix + ": " + EC.message()); +} + +void error(std::error_code EC) { + if (!EC) + return; + error(EC.message()); +} + +} // namespace elf2 +} // namespace lld |
