Use raw_fd_ostream::has_colors instead of StandardErrHasColors().

I just didn't know that raw_fd_ostream has has_colors() function.

llvm-svn: 298749
This commit is contained in:
Rui Ueyama 2017-03-24 23:21:34 +00:00
parent 561d72c328
commit 22f0d804f5
1 changed files with 2 additions and 4 deletions

View File

@ -53,12 +53,10 @@ ELFOptTable::ELFOptTable() : OptTable(OptInfo) {}
// Parse -color-diagnostics={auto,always,never} or -no-color-diagnostics.
static bool getColorDiagnostics(opt::InputArgList &Args) {
bool Default = (ErrorOS == &errs() && Process::StandardErrHasColors());
auto *Arg = Args.getLastArg(OPT_color_diagnostics, OPT_color_diagnostics_eq,
OPT_no_color_diagnostics);
if (!Arg)
return Default;
return ErrorOS->has_colors();
if (Arg->getOption().getID() == OPT_color_diagnostics)
return true;
if (Arg->getOption().getID() == OPT_no_color_diagnostics)
@ -66,7 +64,7 @@ static bool getColorDiagnostics(opt::InputArgList &Args) {
StringRef S = Arg->getValue();
if (S == "auto")
return Default;
return ErrorOS->has_colors();
if (S == "always")
return true;
if (S != "never")