[clang] [HLSL] Rewrite semantics parsing (PR #152537)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 10:41:06 PDT 2025


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/152537 at github.com>


================
@@ -4943,13 +4932,35 @@ def HLSLResourceBinding: InheritableAttr {
   }];
 }
 
-def HLSLSV_Position : HLSLAnnotationAttr {
-  let Spellings = [HLSLAnnotation<"sv_position">];
-  let Subjects = SubjectList<[ParmVar, Field]>;
+def HLSLUnparsedSemantic : HLSLAnnotationAttr {
+  let Spellings = [];
+  let Args = [DefaultIntArgument<"Index", 0>,
+              DefaultBoolArgument<"ExplicitIndex", 0>];
+  let Subjects = SubjectList<[ParmVar, Field, Function]>;
   let LangOpts = [HLSL];
+  let Documentation = [InternalOnly];
+}
+
+def HLSLSV_Position : HLSLSemanticAttr</* Indexable= */ 1> {
   let Documentation = [HLSLSV_PositionDocs];
 }
 
+def HLSLSV_GroupThreadID : HLSLSemanticAttr</* Indexable= */ 0> {
----------------
llvm-beanz wrote:

In a future PR we should change these from being one attribute per system value to instead being a single `HLSLSystemValue` attribute that has an enum to identify which system value.

I don't think we need to change that for this PR, but we should probably do it sooner rather than later.

https://github.com/llvm/llvm-project/pull/152537


More information about the cfe-commits mailing list