This fixes -fcolor-diagnostics to properly enable color output when
not outputting to console devices. Example would be ninja.
This affects only Windows.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Differential D143202
[llvm] Do not use Console API if output isn't a console device kasper93 on Feb 2 2023, 10:08 AM. Authored by
Details
This fixes -fcolor-diagnostics to properly enable color output when This affects only Windows. Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Diff Detail
Event TimelineComment Actions Ok, so I recognize that this is global state and it is not very good to flip it like that. Frankly this Console API usage in llvm is little bit messy it only sets color on STD_OUTPUT_HANDLE, what about STD_ERROR_HANDLE? Anyhow Microsoft documentation strongly suggests to use virtual terminal sequences. And I believe they are supported on all Windows versions that are still not EOL. So how about removing this static bool UseANSI = false; and related code? I can do that, but since I already this review, I might as well ask you for opinion. see https://learn.microsoft.com/en-us/windows/console/setconsoletextattribute |