[libclc] [libclc] Fix unguarded use of image types (PR #136871)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 07:19:51 PDT 2025


https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/136871

Commit 8292e05 which switched the OpenCL C version to 3.0 exposed this issue, which wasn't caught in pre-commit CI.

>From 7c9285f52dde14c1d795c2100c10848876c899d9 Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Wed, 23 Apr 2025 15:18:43 +0100
Subject: [PATCH] [libclc] Fix unguarded use of image types

Commit 8292e05 which switched the OpenCL C version to 3.0 exposed this
issue, which wasn't caught in pre-commit CI.
---
 libclc/generic/include/clc/image/image.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libclc/generic/include/clc/image/image.h b/libclc/generic/include/clc/image/image.h
index 8a7f7a38aa3e7..555ec3904c1f8 100644
--- a/libclc/generic/include/clc/image/image.h
+++ b/libclc/generic/include/clc/image/image.h
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#if defined(__opencl_c_images)
+
 _CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image);
 _CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image);
 
@@ -42,3 +44,5 @@ _CLC_OVERLOAD _CLC_DECL uint4
 read_imageui(image2d_t image, sampler_t sampler, int2 coord);
 _CLC_OVERLOAD _CLC_DECL uint4
 read_imageui(image2d_t image, sampler_t sampler, float2 coord);
+
+#endif



More information about the cfe-commits mailing list