summaryrefslogtreecommitdiff
path: root/lld/unittests
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-03-30 23:10:39 +0000
committerPete Cooper <peter_cooper@apple.com>2016-03-30 23:10:39 +0000
commitf7b36eb00f788111c7fe2ed83459da9b1370b756 (patch)
tree9f7bfeaa1f8b0ad0d56ce7288f3f0cbc86d882bb /lld/unittests
parentb9868a13fff3e6f9890a19bfa360421f0024e70c (diff)
Convert lld file writing to llvm::Error. NFC.
This converts the writeFile method, as well as some of the ones it calls in the normalized binary file writer and yaml writer.
Diffstat (limited to 'lld/unittests')
-rw-r--r--lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp3
-rw-r--r--lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp16
2 files changed, 10 insertions, 9 deletions
diff --git a/lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
index 1a081d04658..d29e0baf27a 100644
--- a/lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
+++ b/lld/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
@@ -735,5 +735,6 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_EQ(printfLabel.type, N_UNDF);
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
- writeBinary(*f, "/tmp/foo.o");
+ auto ec = writeBinary(*f, "/tmp/foo.o");
+ EXPECT_FALSE(ec);
}
diff --git a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
index 87c527233cb..2aff4413ef1 100644
--- a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
+++ b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
@@ -148,8 +148,8 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) {
std::error_code ec =
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
- ec = writeBinary(f, tmpFl);
- EXPECT_FALSE(ec);
+ llvm::Error ec2 = writeBinary(f, tmpFl);
+ EXPECT_FALSE(ec2);
}
std::unique_ptr<MemoryBuffer> bufferOwner;
@@ -260,8 +260,8 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
std::error_code ec =
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
- ec = writeBinary(f, tmpFl);
- EXPECT_FALSE(ec);
+ llvm::Error ec2 = writeBinary(f, tmpFl);
+ EXPECT_FALSE(ec2);
}
std::unique_ptr<MemoryBuffer> bufferOwner;
std::unique_ptr<NormalizedFile> f2;
@@ -378,8 +378,8 @@ TEST(BinaryWriterTest, obj_relocs_armv7) {
std::error_code ec =
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
- ec = writeBinary(f, tmpFl);
- EXPECT_FALSE(ec);
+ llvm::Error ec2 = writeBinary(f, tmpFl);
+ EXPECT_FALSE(ec2);
}
std::unique_ptr<MemoryBuffer> bufferOwner;
std::unique_ptr<NormalizedFile> f2;
@@ -534,8 +534,8 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
std::error_code ec =
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
- ec = writeBinary(f, tmpFl);
- EXPECT_FALSE(ec);
+ llvm::Error ec2 = writeBinary(f, tmpFl);
+ EXPECT_FALSE(ec2);
}
std::unique_ptr<MemoryBuffer> bufferOwner;
std::unique_ptr<NormalizedFile> f2;