[clang] 6b07853 - [SYCL] Change SYCL version according to standard (#114790)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 10:16:48 PST 2024


Author: dklochkov-intel
Date: 2024-12-05T10:16:45-08:00
New Revision: 6b0785390d02193d81d8db7fb12279ffa4651afe

URL: https://github.com/llvm/llvm-project/commit/6b0785390d02193d81d8db7fb12279ffa4651afe
DIFF: https://github.com/llvm/llvm-project/commit/6b0785390d02193d81d8db7fb12279ffa4651afe.diff

LOG: [SYCL] Change SYCL version according to standard (#114790)

Version of SYCL was changed according to the latest agreement:
The lower 2 digits are not formally specified, but we plan to use these
to identify the month in which we submit the specification for
ratification, which is similar to the C++ macro __cplusplus.

Since the SYCL 2020 specification was submitted for ratification in
December of 2020, the macro's value is now 202012 for SYCL 2020.
see PR for details 
https://github.com/KhronosGroup/SYCL-Docs/pull/634

Added: 
    

Modified: 
    clang/lib/Frontend/InitPreprocessor.cpp
    clang/test/Preprocessor/sycl-macro.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 9b611bfcc9e637..e20feedb840b51 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -587,7 +587,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
     if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2017)
       Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
     else if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2020)
-      Builder.defineMacro("SYCL_LANGUAGE_VERSION", "202001");
+      Builder.defineMacro("SYCL_LANGUAGE_VERSION", "202012L");
   }
 
   // Not "standard" per se, but available even with the -undef flag.

diff  --git a/clang/test/Preprocessor/sycl-macro.cpp b/clang/test/Preprocessor/sycl-macro.cpp
index eecddaa09d1c33..a509086f99e413 100644
--- a/clang/test/Preprocessor/sycl-macro.cpp
+++ b/clang/test/Preprocessor/sycl-macro.cpp
@@ -10,5 +10,5 @@
 // CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
 // CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
 // CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
-// CHECK-SYCL-STD-2020:#define SYCL_LANGUAGE_VERSION 202001
+// CHECK-SYCL-STD-2020:#define SYCL_LANGUAGE_VERSION 202012
 // CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1


        


More information about the cfe-commits mailing list