[llvm] b3c5031 - [HLSL] Remove HLSLResource attribute (#130342)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 17 10:00:12 PDT 2025
Author: Helena Kotas
Date: 2025-03-17T10:00:07-07:00
New Revision: b3c5031b07396959c5d4e7f62d516d63de015358
URL: https://github.com/llvm/llvm-project/commit/b3c5031b07396959c5d4e7f62d516d63de015358
DIFF: https://github.com/llvm/llvm-project/commit/b3c5031b07396959c5d4e7f62d516d63de015358.diff
LOG: [HLSL] Remove HLSLResource attribute (#130342)
Fixes #104862
Added:
Modified:
clang/include/clang/Basic/Attr.td
clang/lib/Sema/HLSLExternalSemaSource.cpp
clang/lib/Sema/SemaHLSL.cpp
clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
clang/test/AST/HLSL/TypedBuffers-AST.hlsl
clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl
clang/test/AST/HLSL/cbuffer.hlsl
clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl
clang/test/AST/HLSL/packoffset.hlsl
clang/test/AST/HLSL/pch_hlsl_buffer.hlsl
clang/test/AST/HLSL/resource_binding_attr.hlsl
clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl
llvm/include/llvm/Frontend/HLSL/HLSLResource.h
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 4d34346460561..d9840dad6a5e2 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -4812,33 +4812,6 @@ def HLSLShader : InheritableAttr {
}];
}
-def HLSLResource : InheritableAttr {
- let Spellings = [];
- let Subjects = SubjectList<[Struct]>;
- let LangOpts = [HLSL];
- let Args = [
- EnumArgument<
- "ResourceKind", "llvm::hlsl::ResourceKind",
- /*is_string=*/0,
- [
- "Texture1D", "Texture2D", "Texture2DMS", "Texture3D", "TextureCube",
- "Texture1DArray", "Texture2DArray", "Texture2DMSArray",
- "TextureCubeArray", "TypedBuffer", "RawBuffer", "StructuredBuffer",
- "CBuffer", "Sampler", "TBuffer", "RTAccelerationStructure",
- "FeedbackTexture2D", "FeedbackTexture2DArray"
- ],
- [
- "Texture1D", "Texture2D", "Texture2DMS", "Texture3D", "TextureCube",
- "Texture1DArray", "Texture2DArray", "Texture2DMSArray",
- "TextureCubeArray", "TypedBuffer", "RawBuffer", "StructuredBuffer",
- "CBuffer", "Sampler", "TBuffer", "RTAccelerationStructure",
- "FeedbackTexture2D", "FeedbackTexture2DArray"
- ],
- /*opt=*/0, /*fake=*/0, /*isExternalType=*/1, /*isCovered=*/0>
- ];
- let Documentation = [InternalOnly];
-}
-
def HLSLROV : TypeAttr {
let Spellings = [CXX11<"hlsl", "is_rov">];
let LangOpts = [HLSL];
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index d34d3ef2996ac..cfa49029a2fb1 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -133,7 +133,7 @@ class BuiltinTypeDeclBuilder {
}
BuiltinTypeDeclBuilder &
- addHandleMember(ResourceClass RC, ResourceKind RK, bool IsROV, bool RawBuffer,
+ addHandleMember(ResourceClass RC, bool IsROV, bool RawBuffer,
AccessSpecifier Access = AccessSpecifier::AS_private) {
assert(!Record->isCompleteDefinition() && "record is already complete");
@@ -150,10 +150,9 @@ class BuiltinTypeDeclBuilder {
ElementTypeInfo
? HLSLContainedTypeAttr::CreateImplicit(Ctx, ElementTypeInfo)
: nullptr};
- Attr *ResourceAttr = HLSLResourceAttr::CreateImplicit(Ctx, RK);
if (CreateHLSLAttributedResourceType(SemaRef, Ctx.HLSLResourceTy, Attrs,
AttributedResTy))
- addMemberVariable("__handle", AttributedResTy, {ResourceAttr}, Access);
+ addMemberVariable("__handle", AttributedResTy, {}, Access);
return *this;
}
@@ -857,10 +856,10 @@ void HLSLExternalSemaSource::defineTrivialHLSLTypes() {
/// Set up common members and attributes for buffer types
static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S,
- ResourceClass RC, ResourceKind RK,
- bool IsROV, bool RawBuffer) {
+ ResourceClass RC, bool IsROV,
+ bool RawBuffer) {
return BuiltinTypeDeclBuilder(S, Decl)
- .addHandleMember(RC, RK, IsROV, RawBuffer)
+ .addHandleMember(RC, IsROV, RawBuffer)
.addDefaultHandleConstructor();
}
@@ -999,8 +998,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV,
- ResourceKind::TypedBuffer, /*IsROV=*/false,
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
/*RawBuffer=*/false)
.addArraySubscriptOperators()
.addLoadMethods()
@@ -1012,8 +1010,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV,
- ResourceKind::TypedBuffer, /*IsROV=*/true,
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/true,
/*RawBuffer=*/false)
.addArraySubscriptOperators()
.addLoadMethods()
@@ -1024,8 +1021,8 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, ResourceKind::RawBuffer,
- /*IsROV=*/false, /*RawBuffer=*/true)
+ setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, /*IsROV=*/false,
+ /*RawBuffer=*/true)
.addArraySubscriptOperators()
.addLoadMethods()
.completeDefinition();
@@ -1035,8 +1032,8 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/false, /*RawBuffer=*/true)
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
+ /*RawBuffer=*/true)
.addArraySubscriptOperators()
.addLoadMethods()
.addIncrementCounterMethod()
@@ -1049,8 +1046,8 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/false, /*RawBuffer=*/true)
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
+ /*RawBuffer=*/true)
.addAppendMethod()
.completeDefinition();
});
@@ -1060,8 +1057,8 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/false, /*RawBuffer=*/true)
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
+ /*RawBuffer=*/true)
.addConsumeMethod()
.completeDefinition();
});
@@ -1071,8 +1068,8 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
.addSimpleTemplateParams({"element_type"}, StructuredBufferConcept)
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/true, /*RawBuffer=*/true)
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/true,
+ /*RawBuffer=*/true)
.addArraySubscriptOperators()
.addLoadMethods()
.addIncrementCounterMethod()
@@ -1083,16 +1080,14 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "ByteAddressBuffer")
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, ResourceKind::RawBuffer,
- /*IsROV=*/false,
+ setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, /*IsROV=*/false,
/*RawBuffer=*/true)
.completeDefinition();
});
Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "RWByteAddressBuffer")
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/false,
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
/*RawBuffer=*/true)
.completeDefinition();
});
@@ -1100,8 +1095,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
"RasterizerOrderedByteAddressBuffer")
.finalizeForwardDeclaration();
onCompletion(Decl, [this](CXXRecordDecl *Decl) {
- setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer,
- /*IsROV=*/true,
+ setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/true,
/*RawBuffer=*/true)
.completeDefinition();
});
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 4fc8ff8b38eec..e51dc87d093f0 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -162,10 +162,7 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer,
// if CBuffer is false, then it's a TBuffer
auto RC = CBuffer ? llvm::hlsl::ResourceClass::CBuffer
: llvm::hlsl::ResourceClass::SRV;
- auto RK = CBuffer ? llvm::hlsl::ResourceKind::CBuffer
- : llvm::hlsl::ResourceKind::TBuffer;
Result->addAttr(HLSLResourceClassAttr::CreateImplicit(getASTContext(), RC));
- Result->addAttr(HLSLResourceAttr::CreateImplicit(getASTContext(), RK));
SemaRef.PushOnScopeChains(Result, BufferScope);
SemaRef.PushDeclContext(BufferScope, Result);
diff --git a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
index 12025ab998bad..38e5b6281c42e 100644
--- a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
@@ -41,7 +41,6 @@ RESOURCE Buffer;
// CHECK-UAV-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
// CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(char8_t)]]
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit RawBuffer
// CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const'
// CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'element_type &(unsigned int)'
diff --git a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
index d2b4861361e68..dcead068f481e 100644
--- a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
@@ -88,7 +88,6 @@ RESOURCE<float> Buffer;
// CHECK-UAV-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
// CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]]
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit RawBuffer
// CHECK-SUBSCRIPT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const'
// CHECK-SUBSCRIPT-NEXT: ParmVarDecl {{.*}} Index 'unsigned int'
@@ -219,4 +218,3 @@ RESOURCE<float> Buffer;
// CHECK-ROV-SAME{LITERAL}: [[hlsl::is_rov]]
// CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(float)]]
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit RawBuffer
diff --git a/clang/test/AST/HLSL/TypedBuffers-AST.hlsl b/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
index a6d4a1cfb6f54..f665b06d691e8 100644
--- a/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
@@ -55,7 +55,6 @@ RESOURCE<float> Buffer;
// CHECK-NEXT: FieldDecl {{.*}} implicit __handle '__hlsl_resource_t
// CHECK-UAV-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]]
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit TypedBuffer
// CHECK: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const'
// CHECK-NEXT: ParmVarDecl {{.*}} Index 'unsigned int'
@@ -110,4 +109,3 @@ RESOURCE<float> Buffer;
// CHECK-NEXT: FieldDecl {{.*}} implicit __handle '__hlsl_resource_t
// CHECK-UAV-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(float)]]
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit TypedBuffer
diff --git a/clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl b/clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl
index eca2ed0211d1b..37946b7cedea2 100644
--- a/clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl
+++ b/clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl
@@ -21,7 +21,6 @@ cbuffer A {
// AST: HLSLBufferDecl {{.*}} line:11:9 cbuffer A
// AST-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// AST-NEXT: HLSLResourceAttr {{.*}} Implicit CBuffer
// AST-NEXT: FullComment
// AST-NEXT: ParagraphComment
// AST-NEXT: TextComment {{.*}} Text=" CBuffer decl."
diff --git a/clang/test/AST/HLSL/cbuffer.hlsl b/clang/test/AST/HLSL/cbuffer.hlsl
index e924f7e690297..6c573034a4f7b 100644
--- a/clang/test/AST/HLSL/cbuffer.hlsl
+++ b/clang/test/AST/HLSL/cbuffer.hlsl
@@ -44,9 +44,8 @@ struct TwoFloats {
float b;
};
-// CHECK: HLSLBufferDecl {{.*}} line:50:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} used a1 'hlsl_constant float'
float a1;
@@ -57,9 +56,8 @@ cbuffer CB {
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayout_CB), "");
// Check that buffer layout struct does not include resources or empty types
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} used a2 'hlsl_constant float'
float a2;
@@ -85,9 +83,8 @@ cbuffer CB {
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(TwoFloats, __cblayout_CB_1), "");
// Check that layout struct is created for B and the empty struct C is removed
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} used s1 'hlsl_constant A'
A s1;
@@ -108,9 +105,8 @@ _Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayo
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(TwoFloats, __cblayout_CB_2), "");
// check that layout struct is created for D because of its base struct
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} s4 'hlsl_constant D'
D s4;
@@ -128,9 +124,8 @@ _Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(TwoFloats, __cblay
// check that layout struct is created for E because because its base struct
// is empty and should be eliminated, and BTypedef should reuse the previously
// defined '__cblayout_B'
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} s5 'hlsl_constant E'
E s5;
@@ -149,9 +144,8 @@ _Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayo
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(TwoFloats, __cblayout_CB_4), "");
// check that this produces empty layout struct
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: FunctionDecl {{.*}} f 'void ()'
void f() {}
@@ -169,9 +163,8 @@ cbuffer CB {
}
// check host layout struct with compatible base struct
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: VarDecl {{.*}} s8 'hlsl_constant F'
F s8;
@@ -186,9 +179,8 @@ _Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayo
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayout_CB_6), "");
// anonymous structs
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB {
// CHECK: CXXRecordDecl {{.*}} struct definition
struct {
diff --git a/clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl b/clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl
index 09596eda90b6a..b2860fe07216e 100644
--- a/clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl
+++ b/clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl
@@ -31,9 +31,8 @@ struct Foo {
EmptyStruct es;
};
-// CHECK: HLSLBufferDecl {{.*}} line:37:9 cbuffer CB1
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB1
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB1 {
// CHECK: VarDecl {{.*}} foo1 'hlsl_constant Foo'
Foo foo1;
@@ -61,9 +60,8 @@ namespace NS2 {
float d[4];
EmptyStruct es;
};
- // CHECK: HLSLBufferDecl {{.*}} line:67:11 cbuffer CB2
+ // CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:11 cbuffer CB2
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
- // CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer
cbuffer CB2 {
// CHECK: VarDecl {{.*}} foo0 'hlsl_constant ::Foo':'hlsl_constant Foo'
::Foo foo0;
diff --git a/clang/test/AST/HLSL/packoffset.hlsl b/clang/test/AST/HLSL/packoffset.hlsl
index fee946195f205..1f57540aeac2f 100644
--- a/clang/test/AST/HLSL/packoffset.hlsl
+++ b/clang/test/AST/HLSL/packoffset.hlsl
@@ -5,7 +5,6 @@
cbuffer A
{
// CHECK-NEXT:-HLSLResourceClassAttr {{.*}} Implicit CBuffer
- // CHECK-NEXT:-HLSLResourceAttr {{.*}} Implicit CBuffer
// CHECK-NEXT: VarDecl {{.*}} A1 'hlsl_constant float4'
// CHECK-NEXT: HLSLPackOffsetAttr {{.*}} 0 0
float4 A1 : packoffset(c);
diff --git a/clang/test/AST/HLSL/pch_hlsl_buffer.hlsl b/clang/test/AST/HLSL/pch_hlsl_buffer.hlsl
index 754948931ee53..bfb89b4833677 100644
--- a/clang/test/AST/HLSL/pch_hlsl_buffer.hlsl
+++ b/clang/test/AST/HLSL/pch_hlsl_buffer.hlsl
@@ -19,14 +19,12 @@ float foo() {
// Make sure cbuffer/tbuffer works for PCH.
// CHECK: HLSLBufferDecl {{.*}} line:7:9 imported <undeserialized declarations> cbuffer A
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit CBuffer
// CHECK-NEXT: VarDecl 0x[[A:[0-9a-f]+]] {{.*}} imported used a 'hlsl_constant float'
// CHECK-NEXT: CXXRecordDecl {{.*}} imported implicit <undeserialized declarations> struct __cblayout_A definition
// CHECK: FieldDecl {{.*}} imported a 'float'
// CHECK: HLSLBufferDecl {{.*}} line:11:9 imported <undeserialized declarations> tbuffer B
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit SRV
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit TBuffer
// CHECK-NEXT: VarDecl 0x[[B:[0-9a-f]+]] {{.*}} imported used b 'hlsl_constant float'
// CHECK-NEXT: CXXRecordDecl 0x{{[0-9a-f]+}} {{.*}} imported implicit <undeserialized declarations> struct __cblayout_B definition
// CHECK: FieldDecl 0x{{[0-9a-f]+}} {{.*}} imported b 'float'
diff --git a/clang/test/AST/HLSL/resource_binding_attr.hlsl b/clang/test/AST/HLSL/resource_binding_attr.hlsl
index 26ab85b7d18a5..af43eddc45edd 100644
--- a/clang/test/AST/HLSL/resource_binding_attr.hlsl
+++ b/clang/test/AST/HLSL/resource_binding_attr.hlsl
@@ -1,17 +1,15 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -ast-dump -o - %s | FileCheck %s
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 5]]:9 cbuffer CB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 4]]:9 cbuffer CB
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit CBuffer
// CHECK-NEXT: HLSLResourceBindingAttr {{.*}} "b3" "space2"
// CHECK-NEXT: VarDecl {{.*}} used a 'hlsl_constant float'
cbuffer CB : register(b3, space2) {
float a;
}
-// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 5]]:9 tbuffer TB
+// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 4]]:9 tbuffer TB
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit SRV
-// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit TBuffer
// CHECK-NEXT: HLSLResourceBindingAttr {{.*}} "t2" "space1"
// CHECK-NEXT: VarDecl {{.*}} used b 'hlsl_constant float'
tbuffer TB : register(t2, space1) {
diff --git a/clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl b/clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl
index 8311b518c6e0f..b5737f5dac8a9 100644
--- a/clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl
+++ b/clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl
@@ -6,7 +6,6 @@
// CHECK: FieldDecl {{.*}} implicit __handle '__hlsl_resource_t
// CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(float)]]
-// CHECK: HLSLResourceAttr {{.*}} Implicit TypedBuffer
RWBuffer<float> Buffer1;
// CHECK: ClassTemplateSpecializationDecl {{.*}} class RasterizerOrderedBuffer definition implicit_instantiation
@@ -17,5 +16,4 @@ RWBuffer<float> Buffer1;
// CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]
// CHECK-SAME{LITERAL}: [[hlsl::is_rov]]
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(vector<float, 4>)]]
-// CHECK: HLSLResourceAttr {{.*}} Implicit TypedBuffer
RasterizerOrderedBuffer<vector<float, 4> > BufferArray3[4];
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index 6dacbadb70e7b..cfa0e957c9589 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -20,7 +20,6 @@ namespace hlsl {
// For now we use DXIL ABI enum values directly. This may change in the future.
using dxil::ResourceClass;
-using dxil::ResourceKind;
const unsigned CBufferRowSizeInBytes = 16U;
More information about the llvm-commits
mailing list