xref: /llvm-project/clang/test/ParserHLSL/hlsl_annotations_on_struct_members.hlsl (revision c50ef30cce32b8e864b90a4ca27c68882d46a19c)
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s
2
3// tests that hlsl annotations are properly parsed when applied on field decls,
4// and that the annotation gets properly placed on the AST.
5
6struct Eg9{
7  // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:1, col:8> col:8 implicit struct Eg9
8  // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:10:3, col:16> col:16 referenced a 'unsigned int'
9  // CHECK: -HLSLSV_DispatchThreadIDAttr 0x{{[0-9a-f]+}} <col:20>
10  unsigned int a : SV_DispatchThreadID;
11};
12Eg9 e9;
13
14
15RWBuffer<int> In : register(u1);
16
17
18[numthreads(1,1,1)]
19void main() {
20  In[0] = e9.a;
21}
22