forked from OSchip/llvm-project
parent
85b24f2b36
commit
6400ed4e75
|
@ -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<MemoryBuffer> &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<NormalizedFile*>(&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
|
||||
|
|
|
@ -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<MemoryBuffer> &mb,
|
||||
std::unique_ptr<NormalizedFile> &nf, StringRef archStr) {
|
||||
error_code ec = MemoryBuffer::getFile(path, mb);
|
||||
std::error_code ec = MemoryBuffer::getFile(path, mb);
|
||||
EXPECT_FALSE(ec);
|
||||
|
||||
ErrorOr<std::unique_ptr<NormalizedFile>> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ int main(int argc, const char **argv) {
|
|||
|
||||
{
|
||||
std::unique_ptr<MemoryBuffer> 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<MemoryBuffer> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue