[clang] [HLSL] Add validation for the -enable-16bit-types option (PR #85340)
Natalie Chouinard via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 11:01:40 PDT 2024
================
@@ -4284,11 +4284,25 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
Diags.Report(diag::err_drv_hlsl_bad_shader_unsupported)
<< ShaderModel << T.getOSName() << T.str();
}
+ // validate that if fnative-half-type is given, that
+ // the language standard is at least hlsl2021, and that
+ // the target shader model is at least 6.2
+ if (Args.getLastArg(OPT_fnative_half_type)) {
+ if (!(Opts.LangStd >= LangStandard::lang_hlsl2021 &&
+ T.getOSVersion() >= VersionTuple(6, 2)))
+ Diags.Report(diag::err_drv_dxc_enable_16bit_types_option_invalid);
+ }
} else if (T.isSPIRVLogical()) {
if (!T.isVulkanOS() || T.getVulkanVersion() == VersionTuple(0)) {
Diags.Report(diag::err_drv_hlsl_bad_shader_unsupported)
<< VulkanEnv << T.getOSName() << T.str();
}
+ if (Args.getLastArg(OPT_fnative_half_type)) {
+ if (!(Opts.LangStd >= LangStandard::lang_hlsl2021))
+ Diags.Report(
+ diag::err_drv_cc1_hlsl_spirv_fnative_half_type_option_invalid)
+ << VulkanEnv << T.getOSName() << T.str();
----------------
sudonatalie wrote:
Were these extra params left in by mistake?
https://github.com/llvm/llvm-project/pull/85340
More information about the cfe-commits
mailing list