summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/COFFDump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-objdump/COFFDump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/COFFDump.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/llvm/tools/llvm-objdump/COFFDump.cpp b/llvm/tools/llvm-objdump/COFFDump.cpp
index 251c555b400..e390b99232f 100644
--- a/llvm/tools/llvm-objdump/COFFDump.cpp
+++ b/llvm/tools/llvm-objdump/COFFDump.cpp
@@ -155,67 +155,67 @@ static void printAllUnwindCodes(ArrayRef<UnwindCode> UCs) {
}
// Given a symbol sym this functions returns the address and section of it.
-static std::error_code
-resolveSectionAndAddress(const COFFObjectFile *Obj, const SymbolRef &Sym,
- const coff_section *&ResolvedSection,
- uint64_t &ResolvedAddr) {
+static Error resolveSectionAndAddress(const COFFObjectFile *Obj,
+ const SymbolRef &Sym,
+ const coff_section *&ResolvedSection,
+ uint64_t &ResolvedAddr) {
Expected<uint64_t> ResolvedAddrOrErr = Sym.getAddress();
if (!ResolvedAddrOrErr)
- return errorToErrorCode(ResolvedAddrOrErr.takeError());
+ return ResolvedAddrOrErr.takeError();
ResolvedAddr = *ResolvedAddrOrErr;
Expected<section_iterator> Iter = Sym.getSection();
if (!Iter)
- return errorToErrorCode(Iter.takeError());
+ return Iter.takeError();
ResolvedSection = Obj->getCOFFSection(**Iter);
- return std::error_code();
+ return Error::success();
}
// Given a vector of relocations for a section and an offset into this section
// the function returns the symbol used for the relocation at the offset.
-static std::error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
+static Error resolveSymbol(const std::vector<RelocationRef> &Rels,
uint64_t Offset, SymbolRef &Sym) {
for (auto &R : Rels) {
uint64_t Ofs = R.getOffset();
if (Ofs == Offset) {
Sym = *R.getSymbol();
- return std::error_code();
+ return Error::success();
}
}
- return object_error::parse_failed;
+ return make_error<BinaryError>();
}
// Given a vector of relocations for a section and an offset into this section
// the function resolves the symbol used for the relocation at the offset and
// returns the section content and the address inside the content pointed to
// by the symbol.
-static std::error_code
+static Error
getSectionContents(const COFFObjectFile *Obj,
const std::vector<RelocationRef> &Rels, uint64_t Offset,
ArrayRef<uint8_t> &Contents, uint64_t &Addr) {
SymbolRef Sym;
- if (std::error_code EC = resolveSymbol(Rels, Offset, Sym))
- return EC;
+ if (Error E = resolveSymbol(Rels, Offset, Sym))
+ return E;
const coff_section *Section;
- if (std::error_code EC = resolveSectionAndAddress(Obj, Sym, Section, Addr))
- return EC;
+ if (Error E = resolveSectionAndAddress(Obj, Sym, Section, Addr))
+ return E;
if (std::error_code EC = Obj->getSectionContents(Section, Contents))
- return EC;
- return std::error_code();
+ return errorCodeToError(EC);
+ return Error::success();
}
// Given a vector of relocations for a section and an offset into this section
// the function returns the name of the symbol used for the relocation at the
// offset.
-static std::error_code resolveSymbolName(const std::vector<RelocationRef> &Rels,
- uint64_t Offset, StringRef &Name) {
+static Error resolveSymbolName(const std::vector<RelocationRef> &Rels,
+ uint64_t Offset, StringRef &Name) {
SymbolRef Sym;
- if (std::error_code EC = resolveSymbol(Rels, Offset, Sym))
+ if (Error EC = resolveSymbol(Rels, Offset, Sym))
return EC;
Expected<StringRef> NameOrErr = Sym.getName();
if (!NameOrErr)
- return errorToErrorCode(NameOrErr.takeError());
+ return NameOrErr.takeError();
Name = *NameOrErr;
- return std::error_code();
+ return Error::success();
}
static void printCOFFSymbolAddress(llvm::raw_ostream &Out,
@@ -653,7 +653,7 @@ void llvm::printCOFFSymbolTable(const COFFObjectFile *coff) {
for (unsigned SI = 0, SE = coff->getNumberOfSymbols(); SI != SE; ++SI) {
Expected<COFFSymbolRef> Symbol = coff->getSymbol(SI);
StringRef Name;
- error(errorToErrorCode(Symbol.takeError()));
+ error(Symbol.takeError());
error(coff->getSymbolName(*Symbol, Name));
outs() << "[" << format("%2d", SI) << "]"
OpenPOWER on IntegriCloud