From 6400ed4e758f21d32f030df36a8d387eea21042b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 12 Jun 2014 20:42:12 +0000 Subject: [PATCH] Refer to error_code with an std prefix. llvm-svn: 210820 --- .../MachO/MachONormalizedFileYAML.cpp | 6 ++--- .../MachONormalizedFileBinaryWriterTests.cpp | 23 +++++++++++-------- .../linker-script-test/linker-script-test.cpp | 4 ++-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 459f0555190e..69a144112ddd 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -34,7 +34,6 @@ using llvm::StringRef; -using std::error_code; using namespace llvm::yaml; using namespace llvm::MachO; using namespace lld::mach_o::normalized; @@ -691,8 +690,7 @@ readYaml(std::unique_ptr &mb) { /// Writes a yaml encoded mach-o files from an in-memory normalized view. -error_code -writeYaml(const NormalizedFile &file, raw_ostream &out) { +std::error_code writeYaml(const NormalizedFile &file, raw_ostream &out) { // YAML I/O is not const aware, so need to cast away ;-( NormalizedFile *f = const_cast(&file); @@ -704,7 +702,7 @@ writeYaml(const NormalizedFile &file, raw_ostream &out) { // Stream out yaml. yout << *f; - return error_code(); + return std::error_code(); } } // namespace normalized diff --git a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp index d16ac48df227..5ca7f9dac9cf 100644 --- a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp +++ b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp @@ -22,7 +22,6 @@ using llvm::MemoryBuffer; using llvm::SmallString; using llvm::Twine; using llvm::ErrorOr; -using std::error_code; using namespace llvm::MachO; using namespace lld::mach_o::normalized; @@ -31,7 +30,7 @@ using namespace lld::mach_o::normalized; // Normalized file to nf parameter. static void fromBinary(StringRef path, std::unique_ptr &mb, std::unique_ptr &nf, StringRef archStr) { - error_code ec = MemoryBuffer::getFile(path, mb); + std::error_code ec = MemoryBuffer::getFile(path, mb); EXPECT_FALSE(ec); ErrorOr> r = @@ -144,7 +143,8 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) { f.undefinedSymbols.push_back(makeUndefSymbol("_bar")); f.undefinedSymbols.push_back(makeUndefSymbol("_tbar")); - error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); + std::error_code ec = + llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); EXPECT_FALSE(ec); ec = writeBinary(f, tmpFl); EXPECT_FALSE(ec); @@ -217,7 +217,7 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) { EXPECT_EQ(signed4.isExtern, true); EXPECT_EQ(signed4.symbol, 1U); - error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); + std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); EXPECT_FALSE(ec); } @@ -255,7 +255,8 @@ TEST(BinaryWriterTest, obj_relocs_x86) { f.undefinedSymbols.push_back(makeUndefSymbol("_bar")); f.undefinedSymbols.push_back(makeUndefSymbol("_tbar")); - error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); + std::error_code ec = + llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); EXPECT_FALSE(ec); ec = writeBinary(f, tmpFl); EXPECT_FALSE(ec); @@ -326,7 +327,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) { EXPECT_EQ(tlv.symbol, 1U); //llvm::errs() << "temp = " << tmpFl << "\n"; - error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); + std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); EXPECT_FALSE(ec); } @@ -372,7 +373,8 @@ TEST(BinaryWriterTest, obj_relocs_armv7) { f.globalSymbols.push_back(makeThumbSymbol("_foo2", 0x10)); f.undefinedSymbols.push_back(makeUndefSymbol("_bar")); - error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); + std::error_code ec = + llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); EXPECT_FALSE(ec); ec = writeBinary(f, tmpFl); EXPECT_FALSE(ec); @@ -454,7 +456,7 @@ TEST(BinaryWriterTest, obj_relocs_armv7) { EXPECT_EQ(absPointer.symbol, 2U); //llvm::errs() << "temp = " << tmpFl << "\n"; - error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); + std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); EXPECT_FALSE(ec); } @@ -527,7 +529,8 @@ TEST(BinaryWriterTest, obj_relocs_ppc) { f.globalSymbols.push_back(makeSymbol("_foo2", 0x28)); f.undefinedSymbols.push_back(makeUndefSymbol("_bar")); - error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); + std::error_code ec = + llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl); EXPECT_FALSE(ec); ec = writeBinary(f, tmpFl); EXPECT_FALSE(ec); @@ -682,7 +685,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) { EXPECT_EQ(absloa2.length, 2); EXPECT_EQ(absloa2.symbol, 0U); - error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); + std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl)); EXPECT_FALSE(ec); } diff --git a/lld/utils/linker-script-test/linker-script-test.cpp b/lld/utils/linker-script-test/linker-script-test.cpp index 8de19b6cb772..e481470a4625 100644 --- a/lld/utils/linker-script-test/linker-script-test.cpp +++ b/lld/utils/linker-script-test/linker-script-test.cpp @@ -27,7 +27,7 @@ int main(int argc, const char **argv) { { std::unique_ptr mb; - if (error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) { + if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) { llvm::errs() << ec.message() << "\n"; return 1; } @@ -42,7 +42,7 @@ int main(int argc, const char **argv) { } { std::unique_ptr mb; - if (error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) { + if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) { llvm::errs() << ec.message() << "\n"; return 1; }