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

Andrew Ng via All-commits all-commits at lists.llvm.org
Thu Mar 28 04:42:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9db031c48852af491747dab86ef6f19195eb20d
      https://github.com/llvm/llvm-project/commit/c9db031c48852af491747dab86ef6f19195eb20d
  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.



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