[clang] c1aebd4 - [Clang][OpenCL] Wrap image functions with the macro (#129177)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 3 16:50:56 PST 2025


Author: Victor Mustya
Date: 2025-03-03T16:50:52-08:00
New Revision: c1aebd495be0e468044f716a3a0ff98fccccb2be

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

LOG: [Clang][OpenCL] Wrap image functions with the macro (#129177)

According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
`__IMAGE_SUPPORT__` macro. For the OpenCL C 3.0 and later, the
`__opencl_c_images` macro is used.

Added: 
    

Modified: 
    clang/lib/Headers/opencl-c.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 20719b74b6b8d..8d8ef497cec49 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15082,6 +15082,7 @@ half16 __ovld __cnfn shuffle2(half16, half16, ushort16);
 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 #endif //cl_khr_gl_msaa_sharing
 
+#if (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
 /**
  * Use the coordinate (coord.xy) to do an element lookup in
  * the 2D image object specified by image.
@@ -16143,6 +16144,8 @@ int __ovld __cnfn get_image_num_samples(read_write image2d_array_msaa_depth_t);
 #endif //defined(__opencl_c_read_write_images)
 #endif
 
+#endif // (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
+
 // OpenCL v2.0 s6.13.15 - Work-group Functions
 
 #if defined(__opencl_c_work_group_collective_functions)


        


More information about the cfe-commits mailing list