aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2021-05-18 10:32:22 -0400
committerAaron Ballman <aaron@aaronballman.com>2021-05-18 10:34:14 -0400
commit6381664580080f015bc0c2ec647853f697cf744a (patch)
tree728e71199d1514e90d9317d33bacc92ad04cfd99 /clang/lib/Frontend/CompilerInvocation.cpp
parentba1509da7b89c850c89f0f98afbab375794cd3c8 (diff)
downloadllvm-6381664580080f015bc0c2ec647853f697cf744a.zip
llvm-6381664580080f015bc0c2ec647853f697cf744a.tar.gz
llvm-6381664580080f015bc0c2ec647853f697cf744a.tar.bz2
Introduce SYCL 2020 mode
Currently, we have support for SYCL 1.2.1 (also known as SYCL 2017). This patch introduces the start of support for SYCL 2020 mode, which is the latest SYCL standard available at (https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html). This sets the default SYCL to be 2020 in the driver, and introduces the notion of a "default" version (set to 2020) when cc1 is in SYCL mode but there was no explicit -sycl-std= specified on the command line.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 9cb859f..809492a 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3648,6 +3648,16 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
+ if ((Args.hasArg(OPT_fsycl_is_device) || Args.hasArg(OPT_fsycl_is_host)) &&
+ !Args.hasArg(OPT_sycl_std_EQ)) {
+ // If the user supplied -fsycl-is-device or -fsycl-is-host, but failed to
+ // provide -sycl-std=, we want to default it to whatever the default SYCL
+ // version is. I could not find a way to express this with the options
+ // tablegen because we still want this value to be SYCL_None when the user
+ // is not in device or host mode.
+ Opts.setSYCLVersion(LangOptions::SYCL_Default);
+ }
+
if (Opts.ObjC) {
if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
StringRef value = arg->getValue();