using namespace llvm;
using namespace llvm::object;
-static error_code dumpObject(const ObjectFile &Obj) {
+static std::error_code dumpObject(const ObjectFile &Obj) {
if (Obj.isCOFF())
return coff2yaml(outs(), cast<COFFObjectFile>(Obj));
if (Obj.isELF())
return obj2yaml_error::unsupported_obj_file_format;
}
-static error_code dumpInput(StringRef File) {
+static std::error_code dumpInput(StringRef File) {
if (File != "-" && !sys::fs::exists(File))
return obj2yaml_error::file_not_found;
- ErrorOr<Binary *> BinaryOrErr = createBinary(File);
- if (error_code EC = BinaryOrErr.getError())
+ ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(File);
+ if (std::error_code EC = BinaryOrErr.getError())
return EC;
- std::unique_ptr<Binary> Binary(BinaryOrErr.get());
+ Binary &Binary = *BinaryOrErr.get().getBinary();
// TODO: If this is an archive, then burst it and dump each entry
- if (ObjectFile *Obj = dyn_cast<ObjectFile>(Binary.get()))
+ if (ObjectFile *Obj = dyn_cast<ObjectFile>(&Binary))
return dumpObject(*Obj);
return obj2yaml_error::unrecognized_file_format;
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
- if (error_code EC = dumpInput(InputFilename)) {
+ if (std::error_code EC = dumpInput(InputFilename)) {
errs() << "Error: '" << EC.message() << "'\n";
return 1;
}