[clang] [HLSL] Strict Availability Diagnostics (PR #93860)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 18:27:30 PDT 2024


================
@@ -157,6 +157,18 @@ static bool ShouldDiagnoseAvailabilityInContext(
     }
   }
 
+  // In HLSL, emit diagnostic during parsing only if the diagnostic
+  // mode is set to strict (-fhlsl-strict-availability), and either the decl
+  // availability is not restricted to a specific environment/shader stage,
+  // or the target stage is known (= it is not shader library).
+  if (S.getLangOpts().HLSL) {
+    if (!S.getLangOpts().HLSLStrictAvailability ||
+        (DeclEnv != nullptr &&
+         S.getASTContext().getTargetInfo().getTriple().getEnvironment() ==
----------------
damyanp wrote:

@llvm-beanz mentioned something this morning that made me think there may be a possibility of another environment that isn't a library shader, but also isn't tied to a specific shader stage.  I may have misunderstood though.

If we've already got a load of code making this same assumption then maybe now isn't the right time to tackle it anyway. Happy for no change here.

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


More information about the cfe-commits mailing list