This revision was automatically updated to reflect the committed changes. Closed by commit rGb267ac49e764: [HLSL] Add Resource kind for HLSLResourceAttr. (authored by python3kgae).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135335/new/ https://reviews.llvm.org/D135335 Files: clang/include/clang/Basic/Attr.td clang/lib/Sema/HLSLExternalSemaSource.cpp clang/test/AST/HLSL/RWBuffer-AST.hlsl Index: clang/test/AST/HLSL/RWBuffer-AST.hlsl =================================================================== --- clang/test/AST/HLSL/RWBuffer-AST.hlsl +++ clang/test/AST/HLSL/RWBuffer-AST.hlsl @@ -38,7 +38,7 @@ // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class RWBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final -// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV +// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV TypedBuffer // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit h 'element_type *' // CHECK: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> operator[] 'element_type &const (unsigned int) const' @@ -66,5 +66,5 @@ // CHECK: TemplateArgument type 'float' // CHECK-NEXT: BuiltinType 0x{{[0-9A-Fa-f]+}} 'float' // CHECK-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final -// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV +// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV TypedBuffer // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit referenced h 'float *' Index: clang/lib/Sema/HLSLExternalSemaSource.cpp =================================================================== --- clang/lib/Sema/HLSLExternalSemaSource.cpp +++ clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -116,11 +116,12 @@ } BuiltinTypeDeclBuilder & - annotateResourceClass(HLSLResourceAttr::ResourceClass RC) { + annotateResourceClass(HLSLResourceAttr::ResourceClass RC, + HLSLResourceAttr::ResourceKind RK) { if (Record->isCompleteDefinition()) return *this; Record->addAttr( - HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RC)); + HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RC, RK)); return *this; } @@ -501,6 +502,7 @@ .addHandleMember() .addDefaultHandleConstructor(*SemaPtr, ResourceClass::UAV) .addArraySubscriptOperators() - .annotateResourceClass(HLSLResourceAttr::UAV) + .annotateResourceClass(HLSLResourceAttr::UAV, + HLSLResourceAttr::TypedBuffer) .completeDefinition(); } Index: clang/include/clang/Basic/Attr.td =================================================================== --- clang/include/clang/Basic/Attr.td +++ clang/include/clang/Basic/Attr.td @@ -4037,7 +4037,24 @@ let Args = [EnumArgument<"ResourceType", "ResourceClass", ["SRV", "UAV", "CBuffer", "Sampler"], ["SRV", "UAV", "CBuffer", "Sampler"] - >]; + >, + EnumArgument<"ResourceShape", "ResourceKind", + ["Texture1D", "Texture2D", "Texture2DMS", + "Texture3D", "TextureCube", "Texture1DArray", + "Texture2DArray", "Texture2DMSArray", + "TextureCubeArray", "TypedBuffer", "RawBuffer", + "StructuredBuffer", "CBufferKind", "SamplerKind", + "TBuffer", "RTAccelerationStructure", "FeedbackTexture2D", + "FeedbackTexture2DArray"], + ["Texture1D", "Texture2D", "Texture2DMS", + "Texture3D", "TextureCube", "Texture1DArray", + "Texture2DArray", "Texture2DMSArray", + "TextureCubeArray", "TypedBuffer", "RawBuffer", + "StructuredBuffer", "CBufferKind", "SamplerKind", + "TBuffer", "RTAccelerationStructure", "FeedbackTexture2D", + "FeedbackTexture2DArray"] + > + ]; let Documentation = [InternalOnly]; }
Index: clang/test/AST/HLSL/RWBuffer-AST.hlsl =================================================================== --- clang/test/AST/HLSL/RWBuffer-AST.hlsl +++ clang/test/AST/HLSL/RWBuffer-AST.hlsl @@ -38,7 +38,7 @@ // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class RWBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final -// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV +// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV TypedBuffer // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit h 'element_type *' // CHECK: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> operator[] 'element_type &const (unsigned int) const' @@ -66,5 +66,5 @@ // CHECK: TemplateArgument type 'float' // CHECK-NEXT: BuiltinType 0x{{[0-9A-Fa-f]+}} 'float' // CHECK-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final -// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV +// CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit UAV TypedBuffer // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit referenced h 'float *' Index: clang/lib/Sema/HLSLExternalSemaSource.cpp =================================================================== --- clang/lib/Sema/HLSLExternalSemaSource.cpp +++ clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -116,11 +116,12 @@ } BuiltinTypeDeclBuilder & - annotateResourceClass(HLSLResourceAttr::ResourceClass RC) { + annotateResourceClass(HLSLResourceAttr::ResourceClass RC, + HLSLResourceAttr::ResourceKind RK) { if (Record->isCompleteDefinition()) return *this; Record->addAttr( - HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RC)); + HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RC, RK)); return *this; } @@ -501,6 +502,7 @@ .addHandleMember() .addDefaultHandleConstructor(*SemaPtr, ResourceClass::UAV) .addArraySubscriptOperators() - .annotateResourceClass(HLSLResourceAttr::UAV) + .annotateResourceClass(HLSLResourceAttr::UAV, + HLSLResourceAttr::TypedBuffer) .completeDefinition(); } Index: clang/include/clang/Basic/Attr.td =================================================================== --- clang/include/clang/Basic/Attr.td +++ clang/include/clang/Basic/Attr.td @@ -4037,7 +4037,24 @@ let Args = [EnumArgument<"ResourceType", "ResourceClass", ["SRV", "UAV", "CBuffer", "Sampler"], ["SRV", "UAV", "CBuffer", "Sampler"] - >]; + >, + EnumArgument<"ResourceShape", "ResourceKind", + ["Texture1D", "Texture2D", "Texture2DMS", + "Texture3D", "TextureCube", "Texture1DArray", + "Texture2DArray", "Texture2DMSArray", + "TextureCubeArray", "TypedBuffer", "RawBuffer", + "StructuredBuffer", "CBufferKind", "SamplerKind", + "TBuffer", "RTAccelerationStructure", "FeedbackTexture2D", + "FeedbackTexture2DArray"], + ["Texture1D", "Texture2D", "Texture2DMS", + "Texture3D", "TextureCube", "Texture1DArray", + "Texture2DArray", "Texture2DMSArray", + "TextureCubeArray", "TypedBuffer", "RawBuffer", + "StructuredBuffer", "CBufferKind", "SamplerKind", + "TBuffer", "RTAccelerationStructure", "FeedbackTexture2D", + "FeedbackTexture2DArray"] + > + ]; let Documentation = [InternalOnly]; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits