[clang] [OpenCL] Warn if filter_mode is linear in read_image{i|ui} (PR #204086)
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 19 03:51:24 PDT 2026
================
@@ -576,4 +578,52 @@ bool SemaOpenCL::checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call) {
return false;
}
+void SemaOpenCL::checkBuiltinReadImage(FunctionDecl *FDecl, CallExpr *Call) {
+ IdentifierInfo *II = FDecl->getIdentifier();
+ if (!II)
+ return;
+ StringRef Name = II->getName();
+ if (Name != "read_imagei" && Name != "read_imageui")
+ return;
+
+ // read_image{i|ui} with a sampler take (image, sampler, coord).
+ // Bail out samplerless overloads (image, coord) — 2 args.
+ if (Call->getNumArgs() < 3)
+ return;
+ Expr *SamplerArg = Call->getArg(1);
+ QualType ArgTy = SamplerArg->getType().getCanonicalType();
----------------
svenvh wrote:
I wonder if we should be checking if the param type of `FDecl` is a sampler?
https://github.com/llvm/llvm-project/pull/204086
More information about the cfe-commits
mailing list