[PATCH] D106254: [OpenCL][NFC] Refactors conditional versioning

Justas Janickas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 19 02:13:32 PDT 2021


Topotuna created this revision.
Topotuna added a reviewer: Anastasia.
Herald added subscribers: ldrumm, yaxunl.
Topotuna requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Removes run line declaration -DCL20 and substitutes it with
condition on macro CL_VERSION_2_0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106254

Files:
  clang/test/SemaOpenCL/null_literal.cl


Index: clang/test/SemaOpenCL/null_literal.cl
===================================================================
--- clang/test/SemaOpenCL/null_literal.cl
+++ clang/test/SemaOpenCL/null_literal.cl
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -cl-std=CL1.0 -fdeclare-opencl-builtins -finclude-default-header -verify %s
 // RUN: %clang_cc1 -cl-std=CL1.1 -fdeclare-opencl-builtins -finclude-default-header -verify %s
 // RUN: %clang_cc1 -cl-std=CL1.2 -fdeclare-opencl-builtins -finclude-default-header -verify %s
-// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -fdeclare-opencl-builtins -finclude-default-header -verify %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -verify %s
 
 void foo(){
 
@@ -14,7 +14,7 @@
 
 constant int* ptr4 = (global void*)0; // expected-error{{initializing '__constant int *__private' with an expression of type '__global void *' changes address space of pointer}}
 
-#ifdef CL20
+#if __OPENCL_C_VERSION__ == CL_VERSION_2_0
 // Accept explicitly pointer to generic address space in OpenCL v2.0.
 global int* ptr5 = (generic void*)0;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106254.359700.patch
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210719/94983051/attachment.bin>


More information about the cfe-commits mailing list