X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvm-objdump%2FCOFFDump.cpp;h=001e352c8d0b8f31cdd2067cfd782a0ea393ea20;hb=35da61aba143cc6d35224ed008b30e07bc6486c3;hp=58bdddfa9918e80d5a5912a454eae38aec1dbfb6;hpb=8a80641a85a8b4afeae5058bf6e9ee405d080541;p=oota-llvm.git diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp index 58bdddfa991..001e352c8d0 100644 --- a/tools/llvm-objdump/COFFDump.cpp +++ b/tools/llvm-objdump/COFFDump.cpp @@ -151,7 +151,7 @@ static void printAllUnwindCodes(ArrayRef UCs) { << " remaining in buffer"; return ; } - printUnwindCode(ArrayRef(I, E)); + printUnwindCode(makeArrayRef(I, E)); I += UsedSlots; } } @@ -161,12 +161,14 @@ static std::error_code resolveSectionAndAddress(const COFFObjectFile *Obj, const SymbolRef &Sym, const coff_section *&ResolvedSection, uint64_t &ResolvedAddr) { - if (std::error_code EC = Sym.getAddress(ResolvedAddr)) + ErrorOr ResolvedAddrOrErr = Sym.getAddress(); + if (std::error_code EC = ResolvedAddrOrErr.getError()) return EC; - section_iterator iter(Obj->section_begin()); - if (std::error_code EC = Sym.getSection(iter)) + ResolvedAddr = *ResolvedAddrOrErr; + ErrorOr Iter = Sym.getSection(); + if (std::error_code EC = Iter.getError()) return EC; - ResolvedSection = Obj->getCOFFSection(*iter); + ResolvedSection = Obj->getCOFFSection(**Iter); return std::error_code(); } @@ -239,12 +241,10 @@ printSEHTable(const COFFObjectFile *Obj, uint32_t TableVA, int Count) { return; const pe32_header *PE32Header; - if (error(Obj->getPE32Header(PE32Header))) - return; + error(Obj->getPE32Header(PE32Header)); uint32_t ImageBase = PE32Header->ImageBase; uintptr_t IntPtr = 0; - if (error(Obj->getVaPtr(TableVA, IntPtr))) - return; + error(Obj->getVaPtr(TableVA, IntPtr)); const support::ulittle32_t *P = (const support::ulittle32_t *)IntPtr; outs() << "SEH Table:"; for (int I = 0; I < Count; ++I) @@ -255,8 +255,7 @@ printSEHTable(const COFFObjectFile *Obj, uint32_t TableVA, int Count) { static void printLoadConfiguration(const COFFObjectFile *Obj) { // Skip if it's not executable. const pe32_header *PE32Header; - if (error(Obj->getPE32Header(PE32Header))) - return; + error(Obj->getPE32Header(PE32Header)); if (!PE32Header) return; @@ -265,13 +264,11 @@ static void printLoadConfiguration(const COFFObjectFile *Obj) { return; const data_directory *DataDir; - if (error(Obj->getDataDirectory(COFF::LOAD_CONFIG_TABLE, DataDir))) - return; + error(Obj->getDataDirectory(COFF::LOAD_CONFIG_TABLE, DataDir)); uintptr_t IntPtr = 0; if (DataDir->RelativeVirtualAddress == 0) return; - if (error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr))) - return; + error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr)); auto *LoadConf = reinterpret_cast(IntPtr); outs() << "Load configuration:" @@ -379,8 +376,7 @@ static bool getPDataSection(const COFFObjectFile *Obj, const RuntimeFunction *&RFStart, int &NumRFs) { for (const SectionRef &Section : Obj->sections()) { StringRef Name; - if (error(Section.getName(Name))) - continue; + error(Section.getName(Name)); if (Name != ".pdata") continue; @@ -392,8 +388,7 @@ static bool getPDataSection(const COFFObjectFile *Obj, std::sort(Rels.begin(), Rels.end(), RelocAddressLess); ArrayRef Contents; - if (error(Obj->getSectionContents(Pdata, Contents))) - continue; + error(Obj->getSectionContents(Pdata, Contents)); if (Contents.empty()) continue; @@ -438,7 +433,7 @@ static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) { if (UI->NumCodes) outs() << " Unwind Codes:\n"; - printAllUnwindCodes(ArrayRef(&UI->UnwindCodes[0], UI->NumCodes)); + printAllUnwindCodes(makeArrayRef(&UI->UnwindCodes[0], UI->NumCodes)); outs() << "\n"; outs().flush(); @@ -497,11 +492,10 @@ static void printRuntimeFunctionRels(const COFFObjectFile *Obj, ArrayRef XContents; uint64_t UnwindInfoOffset = 0; - if (error(getSectionContents( + error(getSectionContents( Obj, Rels, SectionOffset + /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8, - XContents, UnwindInfoOffset))) - return; + XContents, UnwindInfoOffset)); if (XContents.empty()) return;