[llvm] [llvm-readobj][COFF] Dump hybrid object for ARM64X files. (PR #102245)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 01:23:40 PDT 2024
================
@@ -360,8 +360,8 @@ createDumper(const ObjectFile &Obj, ScopedPrinter &Writer) {
}
/// Dumps the specified object file.
-static void dumpObject(ObjectFile &Obj, ScopedPrinter &Writer,
- const Archive *A = nullptr) {
+void ObjDumper::dumpObject(ObjectFile &Obj, ScopedPrinter &Writer,
----------------
jh7370 wrote:
I don't like this: you're polluting the generic interface with parameters that are specific to one file format. It's okay to check `Obj.isCOFF()` in this function, and I'm also okay with it becoming an `ObjDumper` member (if moved to ObjDumper.cpp), but the hybrid object check really needs to be within the COFF-specific code.
One alternative approach might be to make the second `dumpObject` call, then call `printCOFFHybridObject` after that call. A variation of this might even be to introduce a new high-level function `dumpCOFFHybridObject`, much like the existing `dumpCOFFImportFile` etc that does this. (NB: I haven't given this a thorough thinking through, so this might not quite work, but hopefully it makes the principle clear).
https://github.com/llvm/llvm-project/pull/102245
More information about the llvm-commits
mailing list