Skip to content

Commit 391ba54

Browse files
committed
new SYCL_LANGUAGE_VERSION macro and etc.
Signed-off-by: Chris Perkins <chris.perkins@intel.com>
1 parent 728dd45 commit 391ba54

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,12 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
463463

464464
if (LangOpts.SYCL) {
465465
// SYCL Version is set to a value when building SYCL applications
466-
if (LangOpts.SYCLVersion == 2017)
466+
if (LangOpts.SYCLVersion == 2017) {
467467
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
468-
else if (LangOpts.SYCLVersion == 2020)
469-
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "202001");
468+
Builder.defineMacro("SYCL_LANGUAGE_VERSION", "201707");
469+
} else if (LangOpts.SYCLVersion == 2020) {
470+
Builder.defineMacro("SYCL_LANGUAGE_VERSION", "202001");
471+
}
470472

471473
if (LangOpts.SYCLValueFitInMaxInt)
472474
Builder.defineMacro("__SYCL_ID_QUERIES_FIT_IN_INT__", "1");

clang/test/Preprocessor/sycl-macro.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
// CHECK-NOT:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1
1414

1515
// CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
16+
// CHECK-SYCL-STD:#define SYCL_LANGUAGE_VERSION 201707
1617
// CHECK-SYCL-STD:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1
1718

18-
// CHECK-SYCL-STD-2020:#define CL_SYCL_LANGUAGE_VERSION 202001
19+
// CHECK-SYCL-STD-2020:#define SYCL_LANGUAGE_VERSION 202001
1920

2021
// CHECK-SYCL-STD-DEVICE:#define __SYCL_DEVICE_ONLY__ 1
2122
// CHECK-SYCL-STD-DEVICE:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1

sycl/include/CL/sycl/handler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include <memory>
3434
#include <type_traits>
3535

36-
// CL_SYCL_LANGUAGE_VERSION is 4 digit year followed by 2 digit revision
37-
#if !CL_SYCL_LANGUAGE_VERSION || CL_SYCL_LANGUAGE_VERSION < 202001
36+
// SYCL_LANGUAGE_VERSION is 4 digit year followed by 2 digit revision
37+
#if !SYCL_LANGUAGE_VERSION || SYCL_LANGUAGE_VERSION < 202001
3838
#define __SYCL_NONCONST_FUNCTOR__
3939
#endif
4040

@@ -812,7 +812,7 @@ class __SYCL_EXPORT handler {
812812
template <typename T> struct ShouldEnableSetArg {
813813
static constexpr bool value =
814814
std::is_trivially_copyable<detail::remove_reference_t<T>>::value
815-
#if CL_SYCL_LANGUAGE_VERSION && CL_SYCL_LANGUAGE_VERSION <= 121
815+
#if SYCL_LANGUAGE_VERSION && SYCL_LANGUAGE_VERSION <= 201707
816816
&& std::is_standard_layout<detail::remove_reference_t<T>>::value
817817
#endif
818818
|| is_same_type<sampler, T>::value // Sampler

sycl/test/basic_tests/macros.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <iostream>
1212

1313
int main() {
14-
std::cout << "SYCL language version: " << CL_SYCL_LANGUAGE_VERSION
15-
<< std::endl;
14+
std::cout << "SYCL language version: " << SYCL_LANGUAGE_VERSION << std::endl;
1615
std::cout << "SYCL compiler version: " << __SYCL_COMPILER_VERSION
1716
<< std::endl;
1817
return 0;

sycl/test/basic_tests/set_arg_error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main() {
4444
5, ntc);
4545
h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}}
4646
4, NonTriviallyCopyable{});
47-
#if CL_SYCL_LANGUAGE_VERSION && CL_SYCL_LANGUAGE_VERSION <= 121
47+
#if SYCL_LANGUAGE_VERSION && SYCL_LANGUAGE_VERSION <= 201707
4848
NonStdLayout nstd;
4949
h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}}
5050
6, nstd);

0 commit comments

Comments
 (0)