================ @@ -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:
Here (and a bit further down in the PR as well) there are places that assume that "not library" implies "known target stage". I wonder if we're opening ourselves up to subtle bugs issues in the future if we end up adding another library-like target? Maybe this is unlikely enough that we can deal with that later? https://github.com/llvm/llvm-project/pull/93860 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits