================ @@ -48,94 +48,108 @@ struct TwoFloats { // CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer // CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer cbuffer CB { - // CHECK: VarDecl {{.*}} col:9 used a1 'hlsl_constant float' + // CHECK: VarDecl {{.*}} used a1 'hlsl_constant float' float a1; - // CHECK: CXXRecordDecl {{.*}} implicit referenced class __layout_CB definition - // CHECK: FieldDecl {{.*}} a1 'float' + // CHECK: CXXRecordDecl {{.*}} implicit referenced struct __cblayout_CB definition + // CHECK: PackedAttr + // CHECK-NEXT: FieldDecl {{.*}} a1 'float' } -_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __layout_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:62:9 cbuffer CB +// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB // CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer // CHECK: HLSLResourceAttr {{.*}} Implicit CBuffer cbuffer CB { - // CHECK: VarDecl {{.*}} col:9 used a2 'hlsl_constant float' + // CHECK: VarDecl {{.*}} used a2 'hlsl_constant float' float a2; - // CHECK: VarDecl {{.*}} col:19 b2 'RWBuffer<float>':'hlsl::RWBuffer<float>' + // CHECK: VarDecl {{.*}} b2 'RWBuffer<float>':'hlsl::RWBuffer<float>' RWBuffer<float> b2; - // CHECK: VarDecl {{.*}} col:15 c2 'EmptyStruct' + // CHECK: VarDecl {{.*}} c2 'EmptyStruct' EmptyStruct c2; - // CHECK: VarDecl {{.*}} col:9 d2 'float[0]' + // CHECK: VarDecl {{.*}} d2 'float[0]' float d2[0]; - // CHECK: VarDecl {{.*}} col:9 e2 'hlsl_constant float' + // CHECK: VarDecl {{.*}} f2 'RWBuffer<float>[2]' + RWBuffer<float> f2[2]; + // CHECK: VarDecl {{.*}} g2 'groupshared float' + groupshared float g2; ---------------- hekota wrote:
The `HLSLBufferDecl` AST node needs to include all declaration that are in the source code. The layout struct starts on line 80 and the checks make sure it only contains 2 floats `a2` and `e2` by using `CHECK-NEXT`. I will move the `__hlsl_resource_t h2;` declaration above `e2` to make sure we check that it is filtered as well. https://github.com/llvm/llvm-project/pull/124840 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits