[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 13:26:16 PDT 2025


================
@@ -863,12 +979,17 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addCopyAssignmentOperator() {
 
   using PH = BuiltinTypeMethodBuilder::PlaceHolder;
   DeclarationName Name = AST.DeclarationNames.getCXXOperatorName(OO_Equal);
-  return BuiltinTypeMethodBuilder(*this, Name, RecordRefType)
-      .addParam("other", ConstRecordRefType)
+  BuiltinTypeMethodBuilder MMB(*this, Name, RecordRefType);
+  MMB.addParam("other", ConstRecordRefType)
       .accessHandleFieldOnResource(PH::_0)
-      .assign(PH::Handle, PH::LastStmt)
-      .returnThis()
-      .finalize();
+      .assign(PH::Handle, PH::LastStmt);
+
+  if (getResourceCounterHandleField()) {
+    MMB.accessCounterHandleFieldOnResource(PH::_0).assign(PH::CounterHandle,
+                                                          PH::LastStmt);
+  }
----------------
hekota wrote:

```suggestion
  if (getResourceCounterHandleField())
    MMB.accessCounterHandleFieldOnResource(PH::_0).assign(PH::CounterHandle,
                                                          PH::LastStmt);
```

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


More information about the cfe-commits mailing list