[all-commits] [llvm/llvm-project] 4429cf: [Support] Allow the ability to change WithColor's ...
Jonas Devlieghere via All-commits
all-commits at lists.llvm.org
Mon Feb 28 20:30:22 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4429cf146e8ad393ec1d4e6bddab73b7e53957d2
https://github.com/llvm/llvm-project/commit/4429cf146e8ad393ec1d4e6bddab73b7e53957d2
Author: Jonas Devlieghere <jonas at devlieghere.com>
Date: 2022-02-28 (Mon, 28 Feb 2022)
Changed paths:
M lldb/tools/driver/Driver.cpp
M llvm/include/llvm/Support/WithColor.h
M llvm/lib/Support/WithColor.cpp
Log Message:
-----------
[Support] Allow the ability to change WithColor's auto detection function
WithColor has an "auto detection mode" which looks whether the
corresponding whether the corresponding cl::opt is enabled or not. While
this is great when opting into cl::opt, it's not so great for downstream
users of this utility, which might have their own competing options to
enable or disable colors. The WithColor constructor takes a color mode,
but the big benefit of the class are its static error and warning
helpers and default error handlers.
In order to allow users of this utility to enable or disable colors
globally, this patch adds the ability to specify a global auto detection
function. By default, the auto detection function behaves the way that
it does today. The benefit of this patch lies in that it can be
overwritten. In addition to a ability to change the auto detection
function, I've also made it possible to get your hands on the default
auto detection function, so you swap it back if if you so desire.
This patch allow downstream users (like LLDB) to globally disable colors
with its own command line flag.
Differential revision: https://reviews.llvm.org/D120593
More information about the All-commits
mailing list