[clang] ad88632 - [OpenCL] Tests C++ for OpenCL version macros

Justas Janickas via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 14 01:49:43 PDT 2021


Author: Justas Janickas
Date: 2021-09-14T09:49:20+01:00
New Revision: ad88632b650325af755ae42ff29114c1f6eb2841

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

LOG: [OpenCL] Tests C++ for OpenCL version macros

Version macro definitions are tested for C++ for OpenCL when
explicit version is provided on command line via `-cl-std` flag.

Differential Revision: https://reviews.llvm.org/D109366

Added: 
    

Modified: 
    clang/test/Preprocessor/predefined-macros.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
index 82077fcdbc76a..14b2d9529e9c2 100644
--- a/clang/test/Preprocessor/predefined-macros.c
+++ b/clang/test/Preprocessor/predefined-macros.c
@@ -137,6 +137,10 @@
 // RUN:   | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM
 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++ \
 // RUN:   | FileCheck -match-full-lines %s --check-prefix=CHECK-CLCPP10
+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++1.0 \
+// RUN:   | FileCheck -match-full-lines %s --check-prefix=CHECK-CLCPP10
+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++2021 \
+// RUN:   | FileCheck -match-full-lines %s --check-prefix=CHECK-CLCPP2021
 // CHECK-CL10: #define CL_VERSION_1_0 100
 // CHECK-CL10: #define CL_VERSION_1_1 110
 // CHECK-CL10: #define CL_VERSION_1_2 120
@@ -174,9 +178,15 @@
 // CHECK-CL30-NOT: #define __FAST_RELAXED_MATH__ 1
 // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1
 // CHECK-CLCPP10: #define __CL_CPP_VERSION_1_0__ 100
+// CHECK-CLCPP10: #define __CL_CPP_VERSION_2021__ 202100
 // CHECK-CLCPP10: #define __OPENCL_CPP_VERSION__ 100
 // CHECK-CLCPP10-NOT: #define __FAST_RELAXED_MATH__ 1
 // CHECK-CLCPP10-NOT: #define __ENDIAN_LITTLE__ 1
+// CHECK-CLCPP2021: #define __CL_CPP_VERSION_1_0__ 100
+// CHECK-CLCPP2021: #define __CL_CPP_VERSION_2021__ 202100
+// CHECK-CLCPP2021: #define __OPENCL_CPP_VERSION__ 202100
+// CHECK-CLCPP2021-NOT: #define __FAST_RELAXED_MATH__ 1
+// CHECK-CLCPP2021-NOT: #define __ENDIAN_LITTLE__ 1
 
 // RUN: %clang_cc1 %s -E -dM -o - -x cl \
 // RUN:   | FileCheck %s --check-prefix=MSCOPE


        


More information about the cfe-commits mailing list