diff options
| author | Hans Wennborg <hans@hanshq.net> | 2019-05-16 12:08:34 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2019-05-16 12:08:34 +0000 |
| commit | 4da9ff9fcfe8987472dc894489597bd338aac85e (patch) | |
| tree | 21bc0332451ec4093db5da5255ee98577ac5926e /llvm/lib/DebugInfo | |
| parent | a8f88c388f75cb03bd21beb0b64f87d8a8727254 (diff) | |
| download | bcm5719-llvm-4da9ff9fcfe8987472dc894489597bd338aac85e.tar.gz bcm5719-llvm-4da9ff9fcfe8987472dc894489597bd338aac85e.zip | |
Revert r360876 "[Object] Change object::SectionRef::getContents() to return Expected<StringRef>"
It broke the Clang build, see llvm-commits thread.
> Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.
>
> Follow-up of D61781.
llvm-svn: 360878
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 9 |
3 files changed, 9 insertions, 18 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 160a171176a..720fadb0dc7 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -1410,14 +1410,8 @@ public: // Try to obtain an already relocated version of this section. // Else use the unrelocated section from the object file. We'll have to // apply relocations ourselves later. - if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data)) { - Expected<StringRef> E = Section.getContents(); - if (E) - Data = *E; - else - // maybeDecompress below will error. - consumeError(E.takeError()); - } + if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data)) + Section.getContents(Data); if (auto Err = maybeDecompress(Section, Name, Data)) { ErrorPolicy EP = HandleError(createError( diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp index fc529630e97..5d453def7b4 100644 --- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp +++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp @@ -53,13 +53,13 @@ SymbolizableObjectFile::create(object::ObjectFile *Obj, if (Obj->getArch() == Triple::ppc64) { for (section_iterator Section : Obj->sections()) { StringRef Name; + StringRef Data; if (auto EC = Section->getName(Name)) return EC; if (Name == ".opd") { - Expected<StringRef> E = Section->getContents(); - if (!E) - return errorToErrorCode(E.takeError()); - OpdExtractor.reset(new DataExtractor(*E, Obj->isLittleEndian(), + if (auto EC = Section->getContents(Data)) + return EC; + OpdExtractor.reset(new DataExtractor(Data, Obj->isLittleEndian(), Obj->getBytesInAddress())); OpdAddress = Section->getAddress(); break; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 00e4139c0ba..7e91a20416b 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -221,12 +221,9 @@ bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName, Section.getName(Name); Name = Name.substr(Name.find_first_not_of("._")); if (Name == "gnu_debuglink") { - Expected<StringRef> ContentsOrErr = Section.getContents(); - if (!ContentsOrErr) { - consumeError(ContentsOrErr.takeError()); - return false; - } - DataExtractor DE(*ContentsOrErr, Obj->isLittleEndian(), 0); + StringRef Data; + Section.getContents(Data); + DataExtractor DE(Data, Obj->isLittleEndian(), 0); uint32_t Offset = 0; if (const char *DebugNameStr = DE.getCStr(&Offset)) { // 4-byte align the offset. |

