]> granicus.if.org Git - llvm/commit
[Object] Change ObjectFile::getSectionContents to return Expected<ArrayRef<uint8_t>>
authorFangrui Song <maskray@google.com>
Tue, 14 May 2019 04:22:51 +0000 (04:22 +0000)
committerFangrui Song <maskray@google.com>
Tue, 14 May 2019 04:22:51 +0000 (04:22 +0000)
commit3e7e9484ee50583323140af83b182312140a056c
tree3ece0ea7732247a20453f9823a1b172c5e350a75
parentb5fa2ca09848dfd0737f30a4638290aaf7c58d8c
[Object] Change ObjectFile::getSectionContents to return Expected<ArrayRef<uint8_t>>

Change
std::error_code getSectionContents(DataRefImpl, StringRef &) const;
to
Expected<ArrayRef<uint8_t>> getSectionContents(DataRefImpl) const;

Many object formats use ArrayRef<uint8_t> as the underlying type, which
is generally better than StringRef to represent binary data, so change
the type to decrease the number of type conversions.

Reviewed By: ruiu, sbc100

Differential Revision: https://reviews.llvm.org/D61781

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360648 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/llvm/Object/COFF.h
include/llvm/Object/ELFObjectFile.h
include/llvm/Object/MachO.h
include/llvm/Object/ObjectFile.h
include/llvm/Object/Wasm.h
include/llvm/Object/XCOFFObjectFile.h
lib/Object/COFFObjectFile.cpp
lib/Object/MachOObjectFile.cpp
lib/Object/WasmObjectFile.cpp
lib/Object/XCOFFObjectFile.cpp
tools/llvm-objcopy/COFF/Reader.cpp
tools/llvm-objcopy/MachO/MachOReader.cpp
tools/llvm-objdump/COFFDump.cpp
tools/obj2yaml/coff2yaml.cpp