[llvm] [llvm-objdump] Fix coloring with nested WithMarkup (PR #113834)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 09:31:56 PDT 2024


================
@@ -226,27 +226,32 @@ format_object<uint64_t> MCInstPrinter::formatHex(uint64_t Value) const {
 
 MCInstPrinter::WithMarkup MCInstPrinter::markup(raw_ostream &OS,
                                                 Markup S) const {
-  return WithMarkup(OS, S, getUseMarkup(), getUseColor());
+  return WithMarkup(const_cast<MCInstPrinter &>(*this), OS, S, getUseMarkup(),
----------------
MaskRay wrote:

Many const methods transitively call the `const` `markup`. If we want to drop `const_cast` here, many target functions `printXXX` will need be adjusted...

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


More information about the llvm-commits mailing list