[llvm] [llvm] Do not use Console API if the output isn't a console device (PR #90230)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 01:48:44 PDT 2024


alvinhochun wrote:

So, I just don't like that this patch calls `llvm::sys::Process::UseANSIEscapeCodes` from the `raw_fd_ostream` ctor. I think making the change in `llvm/lib/Support/Windows/Process.inc`, specifically changing `UseANSI` to be initialized to `true` if not outputting to console would be cleaner.

And after that's done, from what I can find the test `llvm/unittests/Support/WithColorTest.cpp` needs to be enabled for Windows (remove `#ifdef LLVM_ON_UNIX`.

This won't change the behaviour of Clang however, because it calls UseANSIEscapeCodes with the option:
https://github.com/llvm/llvm-project/blob/4202634886b9b8f1ee74713a8ed8c86941891853/clang/lib/Frontend/CompilerInvocation.cpp#L2535
I think the best move forward is to dummy out the option and mark it as deprecated, but that is probably best done in a separate patch.

https://github.com/llvm/llvm-project/pull/90230


More information about the llvm-commits mailing list