[all-commits] [llvm/llvm-project] a385a9: [Support] Fix color handling in formatted_raw_ostr...

Andrew Ng via All-commits all-commits at lists.llvm.org
Thu Mar 28 14:24:33 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a385a917da93a65ffabe1982f5b101db6d15a125
      https://github.com/llvm/llvm-project/commit/a385a917da93a65ffabe1982f5b101db6d15a125
  Author: Andrew Ng <andrew.ng at sony.com>
  Date:   2024-03-28 (Thu, 28 Mar 2024)

  Changed paths:
    M llvm/include/llvm/Support/FormattedStream.h
    M llvm/lib/Support/FormattedStream.cpp
    M llvm/tools/llvm-mc/llvm-mc.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [Support] Fix color handling in formatted_raw_ostream (#86700)

The color methods in formatted_raw_ostream were forwarding directly to
the underlying stream without considering existing buffered output. This
would cause incorrect colored output for buffered uses of
formatted_raw_ostream.

Fix this issue by applying the color to the formatted_raw_ostream itself
and temporarily disabling scanning of any color related output so as not
to affect the position tracking.

This fix means that workarounds that forced formatted_raw_ostream
buffering to be disabled can be removed. In the case of llvm-objdump,
this can improve disassembly performance when redirecting to a file by
more than an order of magnitude on both Windows and Linux. This
improvement restores the disassembly performance when redirecting to a
file to a level similar to before color support was added.

(cherry picked from commit c9db031c48852af491747dab86ef6f19195eb20d)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list