[cfe-commits] r86014 - in /cfe/trunk: lib/Driver/Tools.cpp tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 3 22:24:57 PST 2009
Author: ddunbar
Date: Wed Nov 4 00:24:57 2009
New Revision: 86014
URL: http://llvm.org/viewvc/llvm-project?rev=86014&view=rev
Log:
Move -fcolor-diagnostics logic to driver.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=86014&r1=86013&r2=86014&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 4 00:24:57 2009
@@ -955,9 +955,14 @@
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");
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86014&r1=86013&r2=86014&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 4 00:24:57 2009
@@ -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 @@
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 @@
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
More information about the cfe-commits
mailing list