[all-commits] [llvm/llvm-project] 407d42: [lib/Object] - Make ELFObjectFile::getSymbol() ret...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Wed Dec 16 02:26:30 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 407d42002904ce541f732ce4300913ef57cff232
      https://github.com/llvm/llvm-project/commit/407d42002904ce541f732ce4300913ef57cff232
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-12-16 (Wed, 16 Dec 2020)

  Changed paths:
    M llvm/include/llvm/Object/ELFObjectFile.h
    M llvm/tools/llvm-objdump/ELFDump.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.cpp
    M llvm/unittests/Object/ELFObjectFileTest.cpp

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

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

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 in too many places across LLVM.

Differential revision: https://reviews.llvm.org/D93297




More information about the All-commits mailing list