[PATCH] D94624: [PATCH] [clang-query] Add a --use-color option to clang-query
Tom Ritter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 14 06:39:31 PST 2021
tomrittervg added inline comments.
================
Comment at: clang-tools-extra/clang-query/tool/ClangQuery.cpp:58
+standard output supports colors.)"),
+ cl::init(false), cl::cat(ClangQueryCategory));
+
----------------
steveire wrote:
> tomrittervg wrote:
> > steveire wrote:
> > > aaron.ballman wrote:
> > > > steveire wrote:
> > > > > Doesn't this set the default to false?
> > > > It does, but it does not disable colors by default (I had to double-check this myself), which is why I was asking for the regression tests. That will clearly show the behavior and help ensure we don't regress it in the future.
> > > Did you build and run with the patch?
> > >
> > > Current `clang-query` dumps with color. After this patch, when not using the command line option, there is now no color. with `-use-color`, the color is restored.
> > >
> > > @tomrittervg I know this is based on our discussions, but it's not clear to me what the intent of the patch is. Do you want to be able to disable color?
> > Let me double check - my current clang-query did not dump with color (which is why I made the patch). Maybe this was a mix-up I had.
> https://reviews.llvm.org/D62056 already made dumps use color.
Is that what you're running in your CE instance? You're right, I forgot about that; and that does make it output color on the terminal. But not CE.
I _think_ what's happening is that CE isn't acting like a tty, so clang won't output it in color even if I specify `--extra-arg="-fdiagnostics-color"` (which the analogous `--extra-arg="-fno-diagnostics-color"` _will_ turn off color on the command-line.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94624/new/
https://reviews.llvm.org/D94624
More information about the cfe-commits
mailing list