aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-12-23 22:32:37 +0000
committerNico Weber <nicolasweber@gmx.de>2014-12-23 22:32:37 +0000
commit007215044b48de0ebf32a44c77326c9634b35bdc (patch)
tree03958c6a76a21f2c6d634bcbba5a6db0ce14bf89 /clang/lib/Driver/Tools.cpp
parent9fdeb37bd346089488c5fe77a7edf16ee2f34cb1 (diff)
downloadllvm-007215044b48de0ebf32a44c77326c9634b35bdc.zip
llvm-007215044b48de0ebf32a44c77326c9634b35bdc.tar.gz
llvm-007215044b48de0ebf32a44c77326c9634b35bdc.tar.bz2
Add driver flags -ftrigraphs, -fno-trigraphs.
-trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 1c5a9aa..5212d46 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3412,8 +3412,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
else
Std->render(Args, CmdArgs);
+ // If -f(no-)trigraphs appears after the language standard flag, honor it.
if (Arg *A = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,
- options::OPT_trigraphs))
+ options::OPT_ftrigraphs,
+ options::OPT_fno_trigraphs))
if (A != Std)
A->render(Args, CmdArgs);
} else {
@@ -3429,7 +3431,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
else if (IsWindowsMSVC)
CmdArgs.push_back("-std=c++11");
- Args.AddLastArg(CmdArgs, options::OPT_trigraphs);
+ Args.AddLastArg(CmdArgs, options::OPT_ftrigraphs,
+ options::OPT_fno_trigraphs);
}
// GCC's behavior for -Wwrite-strings is a bit strange: