[all-commits] [llvm/llvm-project] 9ec72c: [llvm-readef/obj] - Change the design structure of...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Jan 12 01:52:25 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ec72cfc61ad5d87bb9e719b8b01f56e4da88a5b
      https://github.com/llvm/llvm-project/commit/9ec72cfc61ad5d87bb9e719b8b01f56e4da88a5b
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [llvm-readef/obj] - Change the design structure of ELF dumper. NFCI.

This is a refactoring for design of stuff in `ELFDumper.cpp`.
The current design of ELF dumper is far from ideal.

Currently most overridden functions (inherited from `ObjDumper`) in `ELFDumper` just forward to
the functions of `ELFDumperStyle` (which can be either `GNUStyle` or `LLVMStyle`).
A concrete implementation may be in any of `ELFDumper`/`DumperStyle`/`GNUStyle`/`LLVMStyle`.

This patch reorganizes the classes by introducing `GNUStyleELFDumper`/`LLVMStyleELFDumper`
which inherit from `ELFDumper`. The implementations are moved:

`DumperStyle` -> `ELFDumper`
`GNUStyle` -> `GNUStyleELFDumper`
`LLVMStyle` -> `LLVMStyleELFDumper`

With that we can avoid having a lot of redirection calls and helper methods.
The number of code lines changes from 7142 to 6922 (reduced by ~3%) and the
code overall looks cleaner.

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




More information about the All-commits mailing list