Skip to content

Commit 3a29ac2

Browse files
committed
[OpenCL] Fix missing const attributes for get_image_ builtins
Various get_image builtin function declarations did not have the const attribute. Bring the const attributes of `-fdeclare-opencl-builtins` more in sync with `opencl-c.h`.
1 parent 418c218 commit 3a29ac2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang/lib/Sema/OpenCLBuiltins.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,21 +1163,21 @@ foreach aQual = ["RO", "WO", "RW"] in {
11631163
Image2dArrayDepth] in {
11641164
foreach name = ["get_image_width", "get_image_channel_data_type",
11651165
"get_image_channel_order"] in {
1166-
def : Builtin<name, [Int, ImageType<imgTy, aQual>]>;
1166+
def : Builtin<name, [Int, ImageType<imgTy, aQual>], Attr.Const>;
11671167
}
11681168
}
11691169
foreach imgTy = [Image2d, Image3d, Image2dArray, Image2dDepth,
11701170
Image2dArrayDepth] in {
1171-
def : Builtin<"get_image_height", [Int, ImageType<imgTy, aQual>]>;
1171+
def : Builtin<"get_image_height", [Int, ImageType<imgTy, aQual>], Attr.Const>;
11721172
}
1173-
def : Builtin<"get_image_depth", [Int, ImageType<Image3d, aQual>]>;
1173+
def : Builtin<"get_image_depth", [Int, ImageType<Image3d, aQual>], Attr.Const>;
11741174
foreach imgTy = [Image2d, Image2dArray, Image2dDepth,
11751175
Image2dArrayDepth] in {
1176-
def : Builtin<"get_image_dim", [VectorType<Int, 2>, ImageType<imgTy, aQual>]>;
1176+
def : Builtin<"get_image_dim", [VectorType<Int, 2>, ImageType<imgTy, aQual>], Attr.Const>;
11771177
}
1178-
def : Builtin<"get_image_dim", [VectorType<Int, 4>, ImageType<Image3d, aQual>]>;
1178+
def : Builtin<"get_image_dim", [VectorType<Int, 4>, ImageType<Image3d, aQual>], Attr.Const>;
11791179
foreach imgTy = [Image1dArray, Image2dArray, Image2dArrayDepth] in {
1180-
def : Builtin<"get_image_array_size", [Size, ImageType<imgTy, aQual>]>;
1180+
def : Builtin<"get_image_array_size", [Size, ImageType<imgTy, aQual>], Attr.Const>;
11811181
}
11821182
}
11831183

0 commit comments

Comments
 (0)