[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 16:37:24 PDT 2024


================
@@ -6155,6 +6155,53 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode {
   }
 };
 
+class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
+public:
+  struct Attributes {
+    // Data gathered from HLSL resource attributes
+    uint8_t ResourceClass; // maps to llvm::dxil::ResourceClass
+    uint8_t IsROV : 1;
+    Attributes(uint8_t RC, bool rov) : ResourceClass(RC), IsROV(rov) {}
+    Attributes() : Attributes(0, 0) {}
----------------
hekota wrote:

I want to make sure that the struct is always zero-initialized. Is there some attribute or trick I can add here to make sure of that, other than the default constructor? I know I can zero-initialize by assigning `= {}` when it is declared as variable and there is probably going to be just a single place where we need to do that so maybe this is not really necessary.

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


More information about the cfe-commits mailing list