Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6400ed4

Browse files
committed
Refer to error_code with an std prefix.
llvm-svn: 210820
1 parent 85b24f2 commit 6400ed4

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535

3636
using llvm::StringRef;
37-
using std::error_code;
3837
using namespace llvm::yaml;
3938
using namespace llvm::MachO;
4039
using namespace lld::mach_o::normalized;
@@ -691,8 +690,7 @@ readYaml(std::unique_ptr<MemoryBuffer> &mb) {
691690

692691

693692
/// Writes a yaml encoded mach-o files from an in-memory normalized view.
694-
error_code
695-
writeYaml(const NormalizedFile &file, raw_ostream &out) {
693+
std::error_code writeYaml(const NormalizedFile &file, raw_ostream &out) {
696694
// YAML I/O is not const aware, so need to cast away ;-(
697695
NormalizedFile *f = const_cast<NormalizedFile*>(&file);
698696

@@ -704,7 +702,7 @@ writeYaml(const NormalizedFile &file, raw_ostream &out) {
704702
// Stream out yaml.
705703
yout << *f;
706704

707-
return error_code();
705+
return std::error_code();
708706
}
709707

710708
} // namespace normalized

lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ using llvm::MemoryBuffer;
2222
using llvm::SmallString;
2323
using llvm::Twine;
2424
using llvm::ErrorOr;
25-
using std::error_code;
2625
using namespace llvm::MachO;
2726
using namespace lld::mach_o::normalized;
2827

@@ -31,7 +30,7 @@ using namespace lld::mach_o::normalized;
3130
// Normalized file to nf parameter.
3231
static void fromBinary(StringRef path, std::unique_ptr<MemoryBuffer> &mb,
3332
std::unique_ptr<NormalizedFile> &nf, StringRef archStr) {
34-
error_code ec = MemoryBuffer::getFile(path, mb);
33+
std::error_code ec = MemoryBuffer::getFile(path, mb);
3534
EXPECT_FALSE(ec);
3635

3736
ErrorOr<std::unique_ptr<NormalizedFile>> r =
@@ -144,7 +143,8 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) {
144143
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
145144
f.undefinedSymbols.push_back(makeUndefSymbol("_tbar"));
146145

147-
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
146+
std::error_code ec =
147+
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
148148
EXPECT_FALSE(ec);
149149
ec = writeBinary(f, tmpFl);
150150
EXPECT_FALSE(ec);
@@ -217,7 +217,7 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) {
217217
EXPECT_EQ(signed4.isExtern, true);
218218
EXPECT_EQ(signed4.symbol, 1U);
219219

220-
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
220+
std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
221221
EXPECT_FALSE(ec);
222222
}
223223

@@ -255,7 +255,8 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
255255
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
256256
f.undefinedSymbols.push_back(makeUndefSymbol("_tbar"));
257257

258-
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
258+
std::error_code ec =
259+
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
259260
EXPECT_FALSE(ec);
260261
ec = writeBinary(f, tmpFl);
261262
EXPECT_FALSE(ec);
@@ -326,7 +327,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
326327
EXPECT_EQ(tlv.symbol, 1U);
327328

328329
//llvm::errs() << "temp = " << tmpFl << "\n";
329-
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
330+
std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
330331
EXPECT_FALSE(ec);
331332
}
332333

@@ -372,7 +373,8 @@ TEST(BinaryWriterTest, obj_relocs_armv7) {
372373
f.globalSymbols.push_back(makeThumbSymbol("_foo2", 0x10));
373374
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
374375

375-
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
376+
std::error_code ec =
377+
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
376378
EXPECT_FALSE(ec);
377379
ec = writeBinary(f, tmpFl);
378380
EXPECT_FALSE(ec);
@@ -454,7 +456,7 @@ TEST(BinaryWriterTest, obj_relocs_armv7) {
454456
EXPECT_EQ(absPointer.symbol, 2U);
455457

456458
//llvm::errs() << "temp = " << tmpFl << "\n";
457-
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
459+
std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
458460
EXPECT_FALSE(ec);
459461
}
460462

@@ -527,7 +529,8 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
527529
f.globalSymbols.push_back(makeSymbol("_foo2", 0x28));
528530
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
529531

530-
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
532+
std::error_code ec =
533+
llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
531534
EXPECT_FALSE(ec);
532535
ec = writeBinary(f, tmpFl);
533536
EXPECT_FALSE(ec);
@@ -682,7 +685,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
682685
EXPECT_EQ(absloa2.length, 2);
683686
EXPECT_EQ(absloa2.symbol, 0U);
684687

685-
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
688+
std::error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
686689
EXPECT_FALSE(ec);
687690
}
688691

lld/utils/linker-script-test/linker-script-test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main(int argc, const char **argv) {
2727

2828
{
2929
std::unique_ptr<MemoryBuffer> mb;
30-
if (error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) {
30+
if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) {
3131
llvm::errs() << ec.message() << "\n";
3232
return 1;
3333
}
@@ -42,7 +42,7 @@ int main(int argc, const char **argv) {
4242
}
4343
{
4444
std::unique_ptr<MemoryBuffer> mb;
45-
if (error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) {
45+
if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(argv[1], mb)) {
4646
llvm::errs() << ec.message() << "\n";
4747
return 1;
4848
}

0 commit comments

Comments
 (0)