r289328 - Simplify parseShowColorsArgs logic, NFC.
Yaron Keren via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 10 06:55:14 PST 2016
Author: yrnkrn
Date: Sat Dec 10 08:55:14 2016
New Revision: 289328
URL: http://llvm.org/viewvc/llvm-project?rev=289328&view=rev
Log:
Simplify parseShowColorsArgs logic, NFC.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=289328&r1=289327&r2=289328&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Dec 10 08:55:14 2016
@@ -930,21 +930,13 @@ static bool parseShowColorsArgs(const Ar
} 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 Ar
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,
More information about the cfe-commits
mailing list