[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 14:34:20 PST 2024


================
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder {
     return *this;
   }
 
+  FieldDecl *getResourceHandleField() {
+    FieldDecl *FD = Fields["h"];
+    assert(FD && FD->getType()->isHLSLAttributedResourceType() &&
+           "record does not have resource handle");
+    return FD;
+  }
+
+  QualType getFirstTemplateTypeParam() {
+    assert(Template && "record it not a template");
+    if (const auto *TTD = dyn_cast<TemplateTypeParmDecl>(
+            Template->getTemplateParameters()->getParam(0))) {
+      return QualType(TTD->getTypeForDecl(), 0);
+    }
+    return QualType();
+  }
+
   BuiltinTypeDeclBuilder &startDefinition() {
-    if (Record->isCompleteDefinition())
-      return *this;
+    // we might already have complete definition from a precompiled header
+    assert(!Record->isCompleteDefinition() && "record is already complete");
----------------
pow2clk wrote:

If we might already have the definition, then we shouldn't assert here.

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


More information about the cfe-commits mailing list