summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-09-13 02:20:00 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-09-13 02:20:00 +0000
commit91e6928464113135f0deff4aa476bab560b1bb14 (patch)
tree01ae10e998ebcde1cccfdd5ee3ea8f25b5e289a8 /lib/Frontend/CompilerInvocation.cpp
parent2bef3ea48658ec42d7e4a0cff421a3c7f8c0375a (diff)
downloadclang-91e6928464113135f0deff4aa476bab560b1bb14.tar.gz
For PR17164: split -fno-lax-vector-conversion into three different
levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 3db0b8827a..0e29e6d9d4 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -2265,7 +2265,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
if (Opts.OpenCL) {
Opts.AltiVec = 0;
Opts.ZVector = 0;
- Opts.LaxVectorConversions = 0;
+ Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::None);
Opts.setDefaultFPContractMode(LangOptions::FPC_On);
Opts.NativeHalfType = 1;
Opts.NativeHalfArgsAndReturns = 1;
@@ -2667,8 +2667,18 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
Opts.ConstStrings);
- if (Args.hasArg(OPT_fno_lax_vector_conversions))
- Opts.LaxVectorConversions = 0;
+ if (Arg *A = Args.getLastArg(OPT_flax_vector_conversions_EQ)) {
+ using LaxKind = LangOptions::LaxVectorConversionKind;
+ if (auto Kind = llvm::StringSwitch<Optional<LaxKind>>(A->getValue())
+ .Case("none", LaxKind::None)
+ .Case("integer", LaxKind::Integer)
+ .Case("all", LaxKind::All)
+ .Default(llvm::None))
+ Opts.setLaxVectorConversions(*Kind);
+ else
+ Diags.Report(diag::err_drv_invalid_value)
+ << A->getAsString(Args) << A->getValue();
+ }
if (Args.hasArg(OPT_fno_threadsafe_statics))
Opts.ThreadsafeStatics = 0;
Opts.Exceptions = Args.hasArg(OPT_fexceptions);