[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 14:50:10 PDT 2024


================
@@ -115,12 +115,19 @@ struct BuiltinTypeDeclBuilder {
     return addMemberVariable("h", Ty, Access);
   }
 
-  BuiltinTypeDeclBuilder &annotateResourceClass(ResourceClass RC,
-                                                ResourceKind RK, bool IsROV) {
+  BuiltinTypeDeclBuilder &annotateHLSLResource(ResourceKind RK, bool IsROV) {
     if (Record->isCompleteDefinition())
       return *this;
-    Record->addAttr(HLSLResourceAttr::CreateImplicit(Record->getASTContext(),
-                                                     RC, RK, IsROV));
+    Record->addAttr(
+        HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RK, IsROV));
+    return *this;
+  }
+
+  BuiltinTypeDeclBuilder &annotateHLSLResourceClass(ResourceClass RC) {
+    if (Record->isCompleteDefinition())
+      return *this;
+    Record->addAttr(
+        HLSLResourceClassAttr::CreateImplicit(Record->getASTContext(), RC));
----------------
bogner wrote:

It's probably simpler to just keep the one `annotateResourceClass` function and add all of the attributes we want there.

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


More information about the cfe-commits mailing list