[clang] [SemaHLSL] Add missing validations of existing semantics (PR #224139)

Deric C. via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 11:57:57 PDT 2026


================
@@ -1106,13 +1106,8 @@ void SemaHLSL::checkSemanticAnnotation(
     return;
   }
 
-  // SV_-prefixed names can have arbitrary interpretations, e.g. SV_Position
-  // on a vertex input. Do not apply system-value constraints to them.
-  if (Interpretation == llvm::hlsl::SemanticInterpretation::Arbitrary)
-    return;
-
----------------
Icohedron wrote:

Why was this arbitrary interpretation guard removed?
This test now fails to compile because all USER semantics are arbitrary:
```hlsl
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -x hlsl -fsyntax-only -verify %s
// expected-no-diagnostics

// USER semantics are arbitrary and may have explicit indices. This entry
// currently aborts when diagnoseSemanticIndex asserts Kind != Arbitrary.
[shader("vertex")]
float4 main(float4 V : USER1) : SV_Position { return V; }
```

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


More information about the cfe-commits mailing list