================
@@ -3780,16 +3814,27 @@ void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
// If the resource array does not have an explicit binding attribute,
// create an implicit one. It will be used to transfer implicit binding
// order_ID to codegen.
- if (!VD->hasAttr<HLSLVkBindingAttr>()) {
- HLSLResourceBindingAttr *RBA = VD->getAttr<HLSLResourceBindingAttr>();
- if (!RBA || !RBA->hasRegisterSlot()) {
+ ResourceBindingAttrs Binding(VD);
+ if (!Binding.isExplicit()) {
+ uint32_t OrderID = getNextImplicitBindingOrderID();
+ if (Binding.hasBinding())
+ Binding.setImplicitOrderID(OrderID);
+ else
+ addImplicitBindingAttrToDecl(
+ SemaRef, VD, getRegisterType(getResourceArrayHandleType(VD)),
+ OrderID);
+ // Re-create the binding object to pick up the new attribute.
+ Binding = ResourceBindingAttrs(VD);
----------------
hekota wrote:
This is needed only when a new attribute was added, so it can be moved to the
`else` branch right after `addImplicitBindingAttrToDecl`.
https://github.com/llvm/llvm-project/pull/162291
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits