From a076ec54bee20c423cf710ea2818d01df84e28b0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 16 May 2019 11:33:48 +0000 Subject: [Object] Change object::SectionRef::getContents() to return Expected Expected> may be better but use Expected for now. Follow-up of D61781. llvm-svn: 360876 --- llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/tools/llvm-cfi-verify') 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("Failed to retrieve section contents", - inconvertibleErrorCode()); + Expected Contents = Section.getContents(); + if (!Contents) + return Contents.takeError(); + ArrayRef SectionBytes = arrayRefFromStringRef(*Contents); - ArrayRef SectionBytes((const uint8_t *)SectionContents.data(), - Section.getSize()); parseSectionContents(SectionBytes, {Section.getAddress(), Section.getIndex()}); } -- cgit v1.1