[clang] [HLSL] Allow input semantics on structs (PR #159047)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 05:57:42 PDT 2025


================
@@ -769,23 +769,81 @@ void SemaHLSL::ActOnTopLevelFunction(FunctionDecl *FD) {
   }
 }
 
-bool SemaHLSL::isSemanticValid(FunctionDecl *FD, DeclaratorDecl *D) {
-  const auto *AnnotationAttr = D->getAttr<HLSLAnnotationAttr>();
-  if (AnnotationAttr) {
-    CheckSemanticAnnotation(FD, D, AnnotationAttr);
-    return true;
+HLSLSemanticAttr *SemaHLSL::createSemantic(const SemanticInfo &Info,
+                                           DeclaratorDecl *TargetDecl) {
+  std::string SemanticName = Info.Semantic->getAttrName()->getName().upper();
+
+  if (SemanticName == "SV_DISPATCHTHREADID") {
----------------
Keenuts wrote:

Yes, agree we might want to do something like `SV_` prefix check (given the entrypoint type etc). This is what later PRs with user semantic do. This PR is keeping the current behavior (also the same diagnostic) for those system semantics as the focus is on struct.
Keeping this as-is to stick to the scope about an early support for struct semantics.

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


More information about the cfe-commits mailing list