From 1c98619801a5705c688e683be3ef9d70169a0686 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:48:50 +0000 Subject: Vendor import of lld release_39 branch r276489: https://llvm.org/svn/llvm-project/lld/branches/release_39@276489 --- lib/Core/Error.cpp | 48 ++++++------------------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) (limited to 'lib/Core/Error.cpp') diff --git a/lib/Core/Error.cpp b/lib/Core/Error.cpp index 3b7733746dcd..4df1ce120bd9 100644 --- a/lib/Core/Error.cpp +++ b/lib/Core/Error.cpp @@ -39,42 +39,6 @@ const std::error_category &lld::YamlReaderCategory() { return o; } -class _LinkerScriptReaderErrorCategory : public std::error_category { -public: - const char *name() const LLVM_NOEXCEPT override { - return "lld.linker-script.reader"; - } - - std::string message(int ev) const override { - switch (static_cast(ev)) { - case LinkerScriptReaderError::success: - return "Success"; - case LinkerScriptReaderError::parse_error: - return "Error parsing linker script"; - case LinkerScriptReaderError::unknown_symbol_in_expr: - return "Unknown symbol found when evaluating linker script expression"; - case LinkerScriptReaderError::unrecognized_function_in_expr: - return "Unrecognized function call when evaluating linker script " - "expression"; - case LinkerScriptReaderError::unknown_phdr_ids: - return "Unknown header identifiers (missing in PHDRS command) are used"; - case LinkerScriptReaderError::extra_program_phdr: - return "Extra program header is found"; - case LinkerScriptReaderError::misplaced_program_phdr: - return "Program header must precede load segments"; - case LinkerScriptReaderError::program_phdr_wrong_phdrs: - return "Program header has invalid PHDRS attribute"; - } - llvm_unreachable("An enumerator of LinkerScriptReaderError does not have a " - "message defined."); - } -}; - -const std::error_category &lld::LinkerScriptReaderCategory() { - static _LinkerScriptReaderErrorCategory o; - return o; -} - namespace lld { /// Temporary class to enable make_dynamic_error_code() until @@ -112,16 +76,16 @@ private: static dynamic_error_category categorySingleton; -std::error_code make_dynamic_error_code(const char *msg) { - return make_dynamic_error_code(StringRef(msg)); -} - std::error_code make_dynamic_error_code(StringRef msg) { return std::error_code(categorySingleton.add(msg), categorySingleton); } -std::error_code make_dynamic_error_code(const Twine &msg) { - return std::error_code(categorySingleton.add(msg.str()), categorySingleton); +char GenericError::ID = 0; + +GenericError::GenericError(Twine Msg) : Msg(Msg.str()) { } + +void GenericError::log(raw_ostream &OS) const { + OS << Msg; } } // namespace lld -- cgit v1.3