[PATCH] D93297: [lib/Object] - Make ELFObjectFile::getSymbol() return Expected<>.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 06:44:07 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added a subscriber: rupprecht.
grimar requested review of this revision.
Herald added a project: LLVM.

This was requested in comments for D93209 <https://reviews.llvm.org/D93209>:
https://reviews.llvm.org/D93209#inline-871192

D93209 <https://reviews.llvm.org/D93209> fixes an issue with `ELFFile<ELFT>::getEntry`,
after what `getSymbol` starts calling `report_fatal_error` for previously
missed invalid cases.

This patch makes it return `Expected<>` and updates callers.
For few of them I had to add new `report_fatal_error` calls. But I see no
way to avoid it currently. The change would affects too many places, e.g:
`getSymbolBinding` and other methods are used from `ELFSymbolRef`
which is used too many places across LLVM.


https://reviews.llvm.org/D93297

Files:
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/tools/llvm-objdump/ELFDump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/unittests/Object/ELFObjectFileTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93297.311892.patch
Type: text/x-patch
Size: 12790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201215/456871f5/attachment.bin>


More information about the llvm-commits mailing list