================
@@ -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:

SV_GroupID (in clang, SV_GroupIndex) isn't supported in the example you 
provided because FieldDecls aren't currently defined as appropriate subjects 
for the annotation to appertain to. Only ParmVars and GlobalVars.
As of right now, SV_DispatchThreadID is the only semantic value annotation that 
has been defined in Attr.td, that can appertain to Field Decls.

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

Reply via email to