diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-04 06:24:57 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-04 06:24:57 +0000 |
commit | 838be483dcf10ea3f2acd85f2cd65adc310011f9 (patch) | |
tree | e1f8025c155bfed0acf97c981636d1b0681977a2 | |
parent | 55efe142a84b2aab6d0186c20a311c347a65f794 (diff) |
Move -fcolor-diagnostics logic to driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86014 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Driver/Tools.cpp | 11 | ||||
-rw-r--r-- | tools/clang-cc/clang-cc.cpp | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 04463be37f..808c31c648 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -955,9 +955,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasFlag(options::OPT_fdiagnostics_show_option, options::OPT_fno_diagnostics_show_option)) CmdArgs.push_back("-fdiagnostics-show-option"); - if (!Args.hasFlag(options::OPT_fcolor_diagnostics, - options::OPT_fno_color_diagnostics)) - CmdArgs.push_back("-fno-color-diagnostics"); + + // Color diagnostics are the default, unless the terminal doesn't support + // them. + if (Args.hasFlag(options::OPT_fcolor_diagnostics, + options::OPT_fno_color_diagnostics) && + llvm::sys::Process::StandardErrHasColors()) + CmdArgs.push_back("-fcolor-diagnostics"); + if (!Args.hasFlag(options::OPT_fshow_source_location, options::OPT_fno_show_source_location)) CmdArgs.push_back("-fno-show-source-location"); diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index c09f44b738..671fc35d18 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -70,7 +70,6 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/System/Host.h" #include "llvm/System/Path.h" -#include "llvm/System/Process.h" #include "llvm/System/Program.h" #include "llvm/System/Signals.h" #include "llvm/Target/TargetSelect.h" @@ -284,10 +283,9 @@ MessageLength("fmessage-length", llvm::cl::value_desc("N")); static llvm::cl::opt<bool> -NoColorDiagnostic("fno-color-diagnostics", - llvm::cl::desc("Don't use colors when showing diagnostics " - "(automatically turned off if output is not a " - "terminal).")); +PrintColorDiagnostic("fcolor-diagnostics", + llvm::cl::desc("Use colors in diagnostics")); + //===----------------------------------------------------------------------===// // C++ Visualization. //===----------------------------------------------------------------------===// @@ -2160,8 +2158,7 @@ int main(int argc, char **argv) { DiagOpts.ShowFixits = !NoDiagnosticsFixIt; DiagOpts.ShowSourceRanges = PrintSourceRangeInfo; DiagOpts.ShowOptionNames = PrintDiagnosticOption; - DiagOpts.ShowColors = (!NoColorDiagnostic && - llvm::sys::Process::StandardErrHasColors()); + DiagOpts.ShowColors = PrintColorDiagnostic; DiagOpts.MessageLength = MessageLength; // Create the diagnostic client for reporting errors or for |