[PATCH] D152285: Add support for the NO_COLOR environment variable
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 08:08:16 PDT 2023
MaskRay added inline comments.
================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2348
+ llvm::sys::Process::GetEnv("NO_COLOR");
+ NoColor && !NoColor->empty() && NoColor->at(0) != '\0') {
+ // If the user set the NO_COLOR environment variable, we'll honor that
----------------
cor3ntin wrote:
> ` NoColor->at(0) != '\0'` seem very superfluous. do you have examples of scenario that would produce a null terminator?
`GetEnv` returned std::string originates from a C string. Just `!NoColor->empty()` is sufficient.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152285/new/
https://reviews.llvm.org/D152285
More information about the cfe-commits
mailing list