diff options
author | Kesavan Yogeswaran <hikes@google.com> | 2022-02-20 22:00:23 +0000 |
---|---|---|
committer | Nathan James <n.james93@hotmail.co.uk> | 2022-02-20 22:00:28 +0000 |
commit | c57b8ca721dd2e88ed96b7df65a518fdab738445 (patch) | |
tree | 4d27165bd603709ff3f2d8aca9b8eab99fdbbef2 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 8f310d1967c20d348c617af3a30999031c71fee0 (diff) | |
download | llvm-c57b8ca721dd2e88ed96b7df65a518fdab738445.zip llvm-c57b8ca721dd2e88ed96b7df65a518fdab738445.tar.gz llvm-c57b8ca721dd2e88ed96b7df65a518fdab738445.tar.bz2 |
[clang-tidy] Provide fine control of color in run-clang-tidy
D90110 modified the behavior of `run-clang-tidy` to always pass the
`--use-color` option to clang-tidy, which enabled colored diagnostics
output regardless of TTY status or .clang-tidy settings. This left the
user with no option to disable the colored output.
This presents an issue when trying to parse the output of run-clang-tidy
programmaticall, as the output is polluted with ANSI escape characters.
This PR fixes this issue in two ways:
1. It restores the default behavior of `run-clang-tidy` to let
`clang-tidy` decide whether to color output. This allows the user to
configure color via the `UseColor` option in a .clang-tidy file.
2. It adds mutually exclusive, optional `-use-color` and `-no-use-color`
argument flags that let the user explicitly set the color option via
the invocation.
After this change the default behavior of `run-clang-tidy` when no
.clang-tidy file is available is now to show no color, presumably
because `clang-tidy` detects that the output is being piped and defaults
to not showing colored output. This seems like an acceptable tradeoff
to respect .clang-tidy configurations, as users can still use the
`-use-color` option to explicitly enable color.
Fixes #49441 (50097 in Bugzilla)
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D119562
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions