[clang] [HLSL] Disallow writing to readonly resources (PR #147806)
Ashley Coleman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 11 12:27:17 PDT 2025
================
@@ -697,7 +699,9 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addArraySubscriptOperators() {
AST.DeclarationNames.getCXXOperatorName(OO_Subscript);
addHandleAccessFunction(Subscript, /*IsConst=*/true, /*IsRef=*/true);
- addHandleAccessFunction(Subscript, /*IsConst=*/false, /*IsRef=*/true);
+ if (ResClass == llvm::dxil::ResourceClass::UAV)
+ addHandleAccessFunction(Subscript, /*IsConst=*/false, /*IsRef=*/true);
----------------
V-FEXrt wrote:
had to drop the `const` since `getResourceHandleField` isn't `const` but otherwise done!
https://github.com/llvm/llvm-project/pull/147806
More information about the cfe-commits
mailing list