aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorNico Rieck <nico.rieck@gmail.com>2013-09-11 00:38:02 +0000
committerNico Rieck <nico.rieck@gmail.com>2013-09-11 00:38:02 +0000
commit7857d46c640b6e631e1219eeb7b77afd832fce4d (patch)
treee4bcc8e5c4eb487a1bd4aff06454e5da40de5ebe /clang/lib/Frontend/CompilerInvocation.cpp
parent4f0409aae53dd04bbbc2ec00e75f62a16e3a3bdf (diff)
downloadllvm-7857d46c640b6e631e1219eeb7b77afd832fce4d.zip
llvm-7857d46c640b6e631e1219eeb7b77afd832fce4d.tar.gz
llvm-7857d46c640b6e631e1219eeb7b77afd832fce4d.tar.bz2
Add -fansi-escape-codes option
Some build systems use pipes for stdin/stderr. On nix-ish platforms colored output can be forced by -fcolor-diagnostics. On Windows this option has no effect in these cases because LLVM uses the console API (which only operates on the console buffer) even if a console wrapper capable of interpreting ANSI escape codes is used. The -fansi-escape-codes option allows switching from the console API to ANSI escape codes. It has no effect on other platforms. llvm-svn: 190464
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index ce4fdc3..669ea5d 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -32,6 +32,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/system_error.h"
#include <sys/stat.h>
using namespace clang;
@@ -543,6 +544,8 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option);
+ llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
+
// Default behavior is to not to show note include stacks.
Opts.ShowNoteIncludeStack = false;
if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack,