[llvm-branch-commits] [clang] [HLSL] Add implicit binding attribute to resource arrays (PR #152452)
Ashley Coleman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 7 11:45:36 PDT 2025
================
@@ -342,6 +346,17 @@ static bool isResourceRecordTypeOrArrayOf(VarDecl *VD) {
return Ty->isHLSLResourceRecord() || Ty->isHLSLResourceRecordArray();
}
+static const HLSLAttributedResourceType *
+getResourceArrayHandleType(VarDecl *VD) {
+ assert(VD->getType()->isHLSLResourceRecordArray() &&
+ "expected array of resource records");
+ const Type *Ty = VD->getType()->getUnqualifiedDesugaredType();
+ while (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty)) {
+ Ty = CAT->getArrayElementTypeNoTypeQual()->getUnqualifiedDesugaredType();
+ }
----------------
V-FEXrt wrote:
This is grabbing the last value in the CAT?
also nit:
```suggestion
while (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty))
Ty = CAT->getArrayElementTypeNoTypeQual()->getUnqualifiedDesugaredType();
```
https://github.com/llvm/llvm-project/pull/152452
More information about the llvm-branch-commits
mailing list