[llvm-readelf/obj] - Move unique warning handling logic to the `ObjDumper`.
authorGeorgii Rymar <grimar@accesssoftek.com>
Fri, 27 Nov 2020 10:34:30 +0000 (13:34 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Tue, 1 Dec 2020 07:53:00 +0000 (10:53 +0300)
commit31eeac915a0a25c2690b956931c77684bc34da0b
tree055a6bf1aed2e5056f79e250bbe469926245e7cb
parente785379afff8dc256fc72a0f74677b43defa2059
[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
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/tools/llvm-readobj/MachODumper.cpp
llvm/tools/llvm-readobj/ObjDumper.cpp
llvm/tools/llvm-readobj/ObjDumper.h
llvm/tools/llvm-readobj/WasmDumper.cpp
llvm/tools/llvm-readobj/XCOFFDumper.cpp