[all-commits] [llvm/llvm-project] 94b88e: [FileCheck] Use default colors in input dumps

Joel E. Denny via All-commits all-commits at lists.llvm.org
Sat Jun 20 09:41:57 PDT 2026


  Branch: refs/heads/users/jdenny-ornl/filecheck-dump-input-default-colors
  Home:   https://github.com/llvm/llvm-project
  Commit: 94b88ef3ecf0c0f9a205ebeb3961dbbcbeff5a63
      https://github.com/llvm/llvm-project/commit/94b88ef3ecf0c0f9a205ebeb3961dbbcbeff5a63
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2026-06-20 (Sat, 20 Jun 2026)

  Changed paths:
    M llvm/include/llvm/Support/WithColor.h
    M llvm/include/llvm/Support/raw_ostream.h
    M llvm/utils/FileCheck/FileCheck.cpp

  Log Message:
  -----------
  [FileCheck] Use default colors in input dumps

This patch makes two improvements to colors used in FileCheck input
dumps:

1. Without this patch, input line numbers and ellipses have a
   foreground color of black, which is hard to see in a terminal with
   a dark color theme.  This patch changes that to the terminal's
   default color.
2. Without this patch, the input text is set to bold but only when
   neither `-v` or `-vv` is specified.  That was an accident when I
   originally implemented this.  Perhaps I never noticed because I
   tend to always use `-vv`.  This patch changes it to use the
   terminal's default color.

Case 2 exposes a problem with LLVM's color implementation.  Without
this patch, the call to `WithColor`'s constructor actually specifies
bold as `false`, but `WithColor` ignores that when the color is
`SAVEDCOLOR`.  While it seems like that should be fixed, I am
concerned about the impact of such a fix on other tools that might
have come to inadvertently depend on the old behavior.  For now, this
patch adds fixme comments to the color APIs.

I never found a nice way to write tests checking that FileCheck emits
expected color codes.  Do I really want to hardcode the exact codes
into tests?  The best I came up with in the past was merely checking
for extra characters, as in `llvm/test/FileCheck/opt-color.txt`, but
that does not really help here as we already expect extra characters
for colors.  Maybe we need a script that translates color codes into
some kind of plain text format with symbolic names instead of codes.
That seems like too much work for this fix, so this patch has no test
changes.



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