forked from OSchip/llvm-project
Simplify parseShowColorsArgs logic, NFC.
llvm-svn: 289328
This commit is contained in:
parent
90a040e745
commit
9181e77504
|
@ -930,21 +930,13 @@ static bool parseShowColorsArgs(const ArgList &Args, bool DefaultColor) {
|
|||
} ShowColors = DefaultColor ? Colors_Auto : Colors_Off;
|
||||
for (Arg *A : Args) {
|
||||
const Option &O = A->getOption();
|
||||
if (!O.matches(options::OPT_fcolor_diagnostics) &&
|
||||
!O.matches(options::OPT_fdiagnostics_color) &&
|
||||
!O.matches(options::OPT_fno_color_diagnostics) &&
|
||||
!O.matches(options::OPT_fno_diagnostics_color) &&
|
||||
!O.matches(options::OPT_fdiagnostics_color_EQ))
|
||||
continue;
|
||||
|
||||
if (O.matches(options::OPT_fcolor_diagnostics) ||
|
||||
O.matches(options::OPT_fdiagnostics_color)) {
|
||||
ShowColors = Colors_On;
|
||||
} else if (O.matches(options::OPT_fno_color_diagnostics) ||
|
||||
O.matches(options::OPT_fno_diagnostics_color)) {
|
||||
ShowColors = Colors_Off;
|
||||
} else {
|
||||
assert(O.matches(options::OPT_fdiagnostics_color_EQ));
|
||||
} else if (O.matches(options::OPT_fdiagnostics_color_EQ)) {
|
||||
StringRef Value(A->getValue());
|
||||
if (Value == "always")
|
||||
ShowColors = Colors_On;
|
||||
|
@ -954,10 +946,9 @@ static bool parseShowColorsArgs(const ArgList &Args, bool DefaultColor) {
|
|||
ShowColors = Colors_Auto;
|
||||
}
|
||||
}
|
||||
if (ShowColors == Colors_On ||
|
||||
(ShowColors == Colors_Auto && llvm::sys::Process::StandardErrHasColors()))
|
||||
return true;
|
||||
return false;
|
||||
return ShowColors == Colors_On ||
|
||||
(ShowColors == Colors_Auto &&
|
||||
llvm::sys::Process::StandardErrHasColors());
|
||||
}
|
||||
|
||||
bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
|
|
Loading…
Reference in New Issue