[clang] [HLSL] Make sure global resources and resource arrays cannot be assigned to (PR #157772)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 15 10:47:34 PDT 2025


================
@@ -15692,6 +15692,12 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
     RHSExpr = resolvedRHS.get();
   }
 
+  if (getLangOpts().HLSL && (LHSExpr->getType()->isHLSLResourceRecord() ||
+                             LHSExpr->getType()->isHLSLResourceRecordArray())) {
+    if (!HLSL().CheckResourceBinOp(Opc, LHSExpr, RHSExpr, OpLoc))
+      return ExprError();
----------------
farzonl wrote:

should we just make this  one conditional so there is no fall through case?

https://github.com/llvm/llvm-project/pull/157772


More information about the cfe-commits mailing list