From 9181e7750465bf645dbf761125ec12f846236cd3 Mon Sep 17 00:00:00 2001 From: Yaron Keren Date: Sat, 10 Dec 2016 14:55:14 +0000 Subject: [PATCH] Simplify parseShowColorsArgs logic, NFC. llvm-svn: 289328 --- clang/lib/Frontend/CompilerInvocation.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index af1ab0715118..e243cf2e356c 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -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,