diff options
Diffstat (limited to 'llvm/tools/llvm-objcopy/MachO/MachOReader.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/MachO/MachOReader.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp index 39702cda4eb..2a1c586bf77 100644 --- a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp +++ b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp @@ -85,11 +85,12 @@ extractSections(const object::MachOObjectFile::LoadCommandInfo &LoadCmd, if (!SecRef) reportError(MachOObj.getFileName(), SecRef.takeError()); - StringRef Content; - if (auto EC = - MachOObj.getSectionContents(SecRef->getRawDataRefImpl(), Content)) - reportError(MachOObj.getFileName(), std::move(EC)); - S.Content = Content; + if (Expected<ArrayRef<uint8_t>> E = + MachOObj.getSectionContents(SecRef->getRawDataRefImpl())) + S.Content = + StringRef(reinterpret_cast<const char *>(E->data()), E->size()); + else + reportError(MachOObj.getFileName(), E.takeError()); S.Relocations.reserve(S.NReloc); for (auto RI = MachOObj.section_rel_begin(SecRef->getRawDataRefImpl()), |