[llvm-readobj] Provide Hash Histogram for all ELFDumper implementations
authorPaul Kirth <paulkirth@google.com>
Sat, 18 Mar 2023 03:33:26 +0000 (03:33 +0000)
committerPaul Kirth <paulkirth@google.com>
Tue, 21 Mar 2023 00:28:03 +0000 (00:28 +0000)
commit0d3f7d2ab333f55cef634e7af834b84e1153e9cf
tree1c1e646d2e56214e70f8c5df1b16e8f22dfb10bd
parent89359df8ca8726c288f3d5e1232eb3f3247dd505
[llvm-readobj] Provide Hash Histogram for all ELFDumper implementations

Previously, the GNUELFDumper was the only implementer for Hash Histograms.
This patch moves the implementation for printHashHistogram and
printGnuHashHistogram into the ELFDumper base class, and allows each
derived class to specialize how it outputs that information.

This change also prevents the JSONELFDumper from emitting invalid JSON,
since the shared implementation in LLVMELFDumper no longer emits a
warning message to the output stream.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137096
llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
llvm/tools/llvm-readobj/ELFDumper.cpp