[clang] [HLSL] Add `[[hlsl::raw_buffer]]` attribute (PR #107954)
Damyan Pepper via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 10:49:15 PDT 2024
================
@@ -6168,10 +6168,19 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
struct Attributes {
// Data gathered from HLSL resource attributes
llvm::dxil::ResourceClass ResourceClass;
+
+ LLVM_PREFERRED_TYPE(bool)
uint8_t IsROV : 1;
- Attributes(llvm::dxil::ResourceClass ResourceClass, bool IsROV)
- : ResourceClass(ResourceClass), IsROV(IsROV) {}
- Attributes() : ResourceClass(llvm::dxil::ResourceClass::UAV), IsROV(0) {}
+
+ LLVM_PREFERRED_TYPE(bool)
+ uint8_t RawBuffer : 1;
+
+ Attributes(llvm::dxil::ResourceClass ResourceClass, bool IsROV,
+ bool RawBuffer)
+ : ResourceClass(ResourceClass), IsROV(IsROV), RawBuffer(RawBuffer) {}
+ Attributes()
+ : ResourceClass(llvm::dxil::ResourceClass::UAV), IsROV(false),
+ RawBuffer(false) {}
----------------
damyanp wrote:
Wondering if a delegating constructor would be preferable here, just to make clear that this version just sets defaults.
```suggestion
Attributes()
: Attributes(llvm::dxil::ResourceClass::UAV, false, false) {}
```
Or maybe we could just provide defaults for the parameters in the other constructor?
https://github.com/llvm/llvm-project/pull/107954
More information about the cfe-commits
mailing list