@@ -2134,9 +2134,15 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
2134
2134
2135
2135
#define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) \
2136
2136
bool is##Id##Type () const ;
2137
+ #include " clang/Basic/OpenCLImageTypes.def"
2138
+ #define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) \
2139
+ bool isSampled##Id##Type () const ;
2140
+ #define IMAGE_WRITE_TYPE (Type, Id, Ext )
2141
+ #define IMAGE_READ_WRITE_TYPE (Type, Id, Ext )
2137
2142
#include " clang/Basic/OpenCLImageTypes.def"
2138
2143
2139
2144
bool isImageType () const ; // Any OpenCL image type
2145
+ bool isSampledImageType () const ; // Any SPIR-V Sampled image type
2140
2146
2141
2147
bool isSamplerT () const ; // OpenCL sampler_t
2142
2148
bool isEventT () const ; // OpenCL event_t
@@ -2520,6 +2526,10 @@ class BuiltinType : public Type {
2520
2526
// OpenCL image types
2521
2527
#define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) Id,
2522
2528
#include " clang/Basic/OpenCLImageTypes.def"
2529
+ #define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) Sampled##Id,
2530
+ #define IMAGE_WRITE_TYPE (Type, Id, Ext )
2531
+ #define IMAGE_READ_WRITE_TYPE (Type, Id, Ext )
2532
+ #include " clang/Basic/OpenCLImageTypes.def"
2523
2533
// OpenCL extension types
2524
2534
#define EXT_OPAQUE_TYPE (ExtType, Id, Ext ) Id,
2525
2535
#include " clang/Basic/OpenCLExtensionTypes.def"
@@ -6847,6 +6857,14 @@ inline bool Type::isDecltypeType() const {
6847
6857
}
6848
6858
#include " clang/Basic/OpenCLImageTypes.def"
6849
6859
6860
+ #define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) \
6861
+ inline bool Type::isSampled##Id##Type() const { \
6862
+ return isSpecificBuiltinType (BuiltinType::Sampled##Id); \
6863
+ }
6864
+ #define IMAGE_WRITE_TYPE (Type, Id, Ext )
6865
+ #define IMAGE_READ_WRITE_TYPE (Type, Id, Ext )
6866
+ #include " clang/Basic/OpenCLImageTypes.def"
6867
+
6850
6868
inline bool Type::isSamplerT () const {
6851
6869
return isSpecificBuiltinType (BuiltinType::OCLSampler);
6852
6870
}
@@ -6869,7 +6887,17 @@ inline bool Type::isReserveIDT() const {
6869
6887
6870
6888
inline bool Type::isImageType () const {
6871
6889
#define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) is##Id##Type() ||
6890
+ return isSampledImageType () ||
6891
+ #include " clang/Basic/OpenCLImageTypes.def"
6892
+ false ; // end boolean or operation
6893
+ }
6894
+
6895
+ inline bool Type::isSampledImageType () const {
6896
+ #define IMAGE_TYPE (ImgType, Id, SingletonId, Access, Suffix ) \
6897
+ isSampled##Id##Type () ||
6872
6898
return
6899
+ #define IMAGE_WRITE_TYPE (Type, Id, Ext )
6900
+ #define IMAGE_READ_WRITE_TYPE (Type, Id, Ext )
6873
6901
#include " clang/Basic/OpenCLImageTypes.def"
6874
6902
false ; // end boolean or operation
6875
6903
}
0 commit comments