Skip to content

Commit 8f98241

Browse files
committed
Addressing feedback
* Moved macro test to Preprocessor * Fixed when the value of the SYCL Standard is set for different flags Signed-off-by: Ruyman Reyes <[email protected]>
1 parent 16746bc commit 8f98241

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4727,7 +4727,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
47274727
// Forward -cl options to -cc1
47284728
RenderOpenCLOptions(Args, CmdArgs);
47294729

4730-
// Forward -sycl options to -cc1
4730+
// Forward -sycl-std option to -cc1
47314731
Args.AddLastArg(CmdArgs, options::OPT_sycl_std_EQ);
47324732

47334733
if (Arg *A = Args.getLastArg(options::OPT_fcf_protection_EQ)) {

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,6 +2433,10 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
24332433
Diags.Report(diag::err_drv_invalid_value)
24342434
<< A->getAsString(Args) << A->getValue();
24352435
}
2436+
} else if (Args.hasArg(options::OPT_fsycl_is_device)
2437+
|| Args.hasArg(options::OPT_fsycl_is_host)
2438+
|| Args.hasArg(options::OPT_fsycl)) {
2439+
Opts.setSYCLVersion(LangOptions::SYCLVersionList::sycl_1_2_1);
24362440
}
24372441

24382442
Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);

clang/test/CodeGenSYCL/macro_definitions.cpp

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
22
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
3-
3+
// RUN: %clang_cc1 %s -fsycl -E -dM | FileCheck --check-prefix=CHECK-ANY-SYCL %s
44
// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
5-
// CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1
5+
// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
6+
// CHECK-ANY-SYCL-NOT:#define __SYCL_DEVICE_ONLY__ 1
7+
// CHECK-ANY-SYCL:#define CL_SYCL_LANGUAGE_VERSION 121
8+
// CHECK-SYCL:#define CL_SYCL_LANGUAGE_VERSION 121

sycl/doc/SYCL_compiler_and_runtime_design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ mode in SYCL:
169169
* IsSYCLOffloadDevice: True if calling clang to set up a device compilation
170170
* IsSYCLHost: True if setting up a call to clang to do a host compilation
171171

172-
The additional option `-sycl-std` allows specifiying which version of
172+
The option `-sycl-std` allows specifiying which version of
173173
the SYCL standard will be used for the compilation.
174174
The default value for this option is `1.2.1`.
175175

0 commit comments

Comments
 (0)