================ @@ -1,10 +1,13 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s -// TODO: update once we handle annotations on struct fields +// tests that hlsl annotations are properly parsed when applied on field decls, +// and that the annotation gets properly placed on the AST. struct Eg9{ -// expected-error@+1{{attribute 'SV_DispatchThreadID' only applies to parameter}} - int a : SV_DispatchThreadID; + // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:1, col:8> col:8 implicit struct Eg9 + // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:10:3, col:16> col:16 referenced a 'unsigned int' + // CHECK: -HLSLSV_DispatchThreadIDAttr 0x{{[0-9a-f]+}} <col:20> + unsigned int a : SV_DispatchThreadID; ---------------- bob80905 wrote:
Further, the annotation will be ignored when the HLSL Parser tries to parse it due to the subject not being correct, and this warning will result: ``` warning: 'SV_GroupIndex' attribute only applies to parameters and global variables [-Wignored-attributes] ``` https://github.com/llvm/llvm-project/pull/96346 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits