summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cfi-verify
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-cfi-verify')
-rw-r--r--llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp10
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 ff2ce46a01d..4bf308f87c2 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()});
}
OpenPOWER on IntegriCloud