[llvm] [llvm-objdump] Fix --disassembler-color with --macho flag (PR #163815)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 00:13:26 PDT 2025


================
@@ -7321,6 +7321,19 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
   CHECK_TARGET_INFO_CREATION(IP);
   // Set the display preference for hex vs. decimal immediates.
   IP->setPrintImmHex(PrintImmHex);
+  // Set up disassembler color output.
+  switch (DisassemblyColor) {
----------------
jh7370 wrote:

Rather than duplicating this switch, perhaps we could have a function or similar that's shared between the two code paths (Mach-O and non-Mach-O) that does this setting up? I note that both paths also call `setPrintImmHex`, for example, and I wonder if there are other parts of the regular code path that should be used here but aren't, currently.

https://github.com/llvm/llvm-project/pull/163815


More information about the llvm-commits mailing list