From 4956850fdc98ddf9f07f8325f29cc7ba66b804d2 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 12 Jun 2014 14:04:54 +0000 Subject: [PATCH] replace llvm::error_code with std::error_code. llvm-svn: 210781 --- lld/include/lld/Core/Error.h | 24 +++++++++---------- lld/include/lld/Core/LLVM.h | 2 +- lld/lib/Core/Error.cpp | 9 ++++--- .../MachO/MachONormalizedFileYAML.cpp | 2 +- .../MachONormalizedFileBinaryWriterTests.cpp | 2 +- .../MachONormalizedFileYAMLTests.cpp | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/lld/include/lld/Core/Error.h b/lld/include/lld/Core/Error.h index e2732c83b0b6..e6c0c71418d6 100644 --- a/lld/include/lld/Core/Error.h +++ b/lld/include/lld/Core/Error.h @@ -30,8 +30,8 @@ enum class NativeReaderError { memory_error, }; -inline llvm::error_code make_error_code(NativeReaderError e) { - return llvm::error_code(static_cast(e), native_reader_category()); +inline std::error_code make_error_code(NativeReaderError e) { + return std::error_code(static_cast(e), native_reader_category()); } const std::error_category &YamlReaderCategory(); @@ -42,8 +42,8 @@ enum class YamlReaderError { illegal_value }; -inline llvm::error_code make_error_code(YamlReaderError e) { - return llvm::error_code(static_cast(e), YamlReaderCategory()); +inline std::error_code make_error_code(YamlReaderError e) { + return std::error_code(static_cast(e), YamlReaderCategory()); } const std::error_category &LinkerScriptReaderCategory(); @@ -53,8 +53,8 @@ enum class LinkerScriptReaderError { parse_error }; -inline llvm::error_code make_error_code(LinkerScriptReaderError e) { - return llvm::error_code(static_cast(e), LinkerScriptReaderCategory()); +inline std::error_code make_error_code(LinkerScriptReaderError e) { + return std::error_code(static_cast(e), LinkerScriptReaderCategory()); } /// \brief Errors returned by InputGraph functionality @@ -67,8 +67,8 @@ enum class InputGraphError { no_more_files }; -inline llvm::error_code make_error_code(InputGraphError e) { - return llvm::error_code(static_cast(e), InputGraphErrorCategory()); +inline std::error_code make_error_code(InputGraphError e) { + return std::error_code(static_cast(e), InputGraphErrorCategory()); } /// \brief Errors returned by Reader. @@ -79,8 +79,8 @@ enum class ReaderError { unknown_file_format = 1 }; -inline llvm::error_code make_error_code(ReaderError e) { - return llvm::error_code(static_cast(e), ReaderErrorCategory()); +inline std::error_code make_error_code(ReaderError e) { + return std::error_code(static_cast(e), ReaderErrorCategory()); } @@ -90,8 +90,8 @@ inline llvm::error_code make_error_code(ReaderError e) { /// supplied error string. /// Note: Once ErrorOr<> is updated to work with errors other than error_code, /// this can be updated to return some other kind of error. -llvm::error_code make_dynamic_error_code(StringRef msg); -llvm::error_code make_dynamic_error_code(const Twine &msg); +std::error_code make_dynamic_error_code(StringRef msg); +std::error_code make_dynamic_error_code(const Twine &msg); } // end namespace lld diff --git a/lld/include/lld/Core/LLVM.h b/lld/include/lld/Core/LLVM.h index ed9742133355..d388d86dd813 100644 --- a/lld/include/lld/Core/LLVM.h +++ b/lld/include/lld/Core/LLVM.h @@ -61,7 +61,7 @@ namespace lld { using llvm::SaveAndRestore; using llvm::ErrorOr; - using llvm::error_code; + using std::error_code; using llvm::raw_ostream; } // end namespace lld. diff --git a/lld/lib/Core/Error.cpp b/lld/lib/Core/Error.cpp index 210f1ebc62bb..25da2b396b2a 100644 --- a/lld/lib/Core/Error.cpp +++ b/lld/lib/Core/Error.cpp @@ -209,13 +209,12 @@ private: static dynamic_error_category categorySingleton; - -llvm::error_code make_dynamic_error_code(StringRef msg) { - return llvm::error_code(categorySingleton.add(msg), categorySingleton); +std::error_code make_dynamic_error_code(StringRef msg) { + return std::error_code(categorySingleton.add(msg), categorySingleton); } -llvm::error_code make_dynamic_error_code(const Twine &msg) { - return llvm::error_code(categorySingleton.add(msg.str()), categorySingleton); +std::error_code make_dynamic_error_code(const Twine &msg) { + return std::error_code(categorySingleton.add(msg.str()), categorySingleton); } } diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index d792975dc717..f5c3c4d12da4 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -36,7 +36,7 @@ using llvm::StringRef; -using llvm::error_code; +using std::error_code; using namespace llvm::yaml; using namespace llvm::MachO; using namespace lld::mach_o::normalized; diff --git a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp index 36869c0ae563..ff8106020c3e 100644 --- a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp +++ b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp @@ -24,7 +24,7 @@ using llvm::MemoryBuffer; using llvm::SmallString; using llvm::Twine; using llvm::ErrorOr; -using llvm::error_code; +using std::error_code; using namespace llvm::MachO; using namespace lld::mach_o::normalized; diff --git a/lld/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp index 0ad787dafbd9..79d56034237b 100644 --- a/lld/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp +++ b/lld/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp @@ -35,7 +35,7 @@ static std::unique_ptr fromYAML(StringRef str) { static void toYAML(const NormalizedFile &f, std::string &out) { llvm::raw_string_ostream ostr(out); - llvm::error_code ec = lld::mach_o::normalized::writeYaml(f, ostr); + std::error_code ec = lld::mach_o::normalized::writeYaml(f, ostr); EXPECT_TRUE(!ec); }