[all-commits] [llvm/llvm-project] 0af663: [llvm-objdump] Create ObjectFile specific dumpers

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jul 14 12:44:54 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0af663f80da0009f6fd879cf4d41743d4c88a2db
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M llvm/tools/llvm-objdump/COFFDump.cpp
    M llvm/tools/llvm-objdump/ELFDump.cpp
    M llvm/tools/llvm-objdump/ELFDump.h
    M llvm/tools/llvm-objdump/MachODump.cpp
    M llvm/tools/llvm-objdump/WasmDump.cpp
    M llvm/tools/llvm-objdump/XCOFFDump.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.h

  Log Message:
  [llvm-objdump] Create ObjectFile specific dumpers

We pay the one-off boilerplate overhead to create `*Dumper` classes that derive
from objdump::Dumper a la llvm-readobj. This has two primary advantages.

First, a lot object file format specific code can be moved from
llvm-objdump.cpp to *Dump.cpp files. Refactor `printPrivateHeaders` as
an example.

Second, with the introduction of ELFDumper<ELFT>, we can simplify
a few dispatch functions in ELFDump.cpp.

In addition, the ObjectFile specific dumpers contains a ObjectFile specific
reference so that we can remove a lot of `cast<*ObjectFile>(Obj)`.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D155045

More information about the All-commits mailing list