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

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 20:39:49 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) {}
----------------
bogner wrote:

If we don't ever default construct the object, this can simply be `Attributes() = delete;`, so trying to create this without initializing it is impossible. If we do need a default constructor then what you have is the best we can do - default member initialization for bitfields is in C++20 but we have to stick to 17.

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


More information about the cfe-commits mailing list