[all-commits] [llvm/llvm-project] 31eeac: [llvm-readelf/obj] - Move unique warning handling ...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Dec 1 00:04:32 PST 2020


  Branch: refs/heads/temp-test-main
  Home:   https://github.com/llvm/llvm-project
  Commit: 31eeac915a0a25c2690b956931c77684bc34da0b
      https://github.com/llvm/llvm-project/commit/31eeac915a0a25c2690b956931c77684bc34da0b
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-12-01 (Tue, 01 Dec 2020)

  Changed paths:
    M llvm/tools/llvm-readobj/COFFDumper.cpp
    M llvm/tools/llvm-readobj/ELFDumper.cpp
    M llvm/tools/llvm-readobj/MachODumper.cpp
    M llvm/tools/llvm-readobj/ObjDumper.cpp
    M llvm/tools/llvm-readobj/ObjDumper.h
    M llvm/tools/llvm-readobj/WasmDumper.cpp
    M llvm/tools/llvm-readobj/XCOFFDumper.cpp

  Log Message:
  -----------
  [llvm-readelf/obj] - Move unique warning handling logic to the `ObjDumper`.

This moves the `reportUniqueWarning` method to the base class.

My motivation is the following:
I've experimented with replacing `reportWarning` calls with `reportUniqueWarning`
in ELF dumper. I've found that for example for removing them from `DynRegionInfo` helper
class, it is worth to pass a dumper instance to it (to be able to call dumper()->reportUniqueWarning()).
The problem was that `ELFDumper<ELFT>` is a template class. I had to make `DynRegionInfo` to be templated
and do lots of minor changes everywhere what did not look reasonable/nice.

At the same time I guess one day other dumpers like COFF/MachO/Wasm etc might want to
start using `reportUniqueWarning` API too. Then it looks reasonable to move the logic to the
base class.

With that the problem of passing the dumper instance will be gone.

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




More information about the All-commits mailing list