diff options
author | Fangrui Song <maskray@google.com> | 2019-05-16 11:33:48 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-05-16 11:33:48 +0000 |
commit | a076ec54bee20c423cf710ea2818d01df84e28b0 (patch) | |
tree | 9349552e719590d0d902eb3e688645141e47d9e3 /llvm/tools/llvm-cfi-verify | |
parent | 671fc5f3f44986f7d20c3fcf2126cfad39b1adaf (diff) | |
download | llvm-a076ec54bee20c423cf710ea2818d01df84e28b0.zip llvm-a076ec54bee20c423cf710ea2818d01df84e28b0.tar.gz llvm-a076ec54bee20c423cf710ea2818d01df84e28b0.tar.bz2 |
[Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.
Follow-up of D61781.
llvm-svn: 360876
Diffstat (limited to 'llvm/tools/llvm-cfi-verify')
-rw-r--r-- | llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp index ff2ce46..4bf308f 100644 --- a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp +++ b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp @@ -453,13 +453,11 @@ Error FileAnalysis::parseCodeSections() { if (!Section.getName(SectionName) && SectionName == ".plt") continue; - StringRef SectionContents; - if (Section.getContents(SectionContents)) - return make_error<StringError>("Failed to retrieve section contents", - inconvertibleErrorCode()); + Expected<StringRef> Contents = Section.getContents(); + if (!Contents) + return Contents.takeError(); + ArrayRef<uint8_t> SectionBytes = arrayRefFromStringRef(*Contents); - ArrayRef<uint8_t> SectionBytes((const uint8_t *)SectionContents.data(), - Section.getSize()); parseSectionContents(SectionBytes, {Section.getAddress(), Section.getIndex()}); } |