[clang] [HLSL] Add validation for the -enable-16bit-types option (PR #85340)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 11:00:44 PDT 2024


================
@@ -0,0 +1,20 @@
+// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 2016 %s 2>&1  | FileCheck -check-prefix=both_invalid %s
+// RUN: not %clang_dxc -enable-16bit-types -T lib_6_4 -HV 2017 %s 2>&1 | FileCheck -check-prefix=HV_invalid %s
+// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 /HV 2021 %s 2>&1  | FileCheck -check-prefix=TP_invalid %s
+// RUN: %clang_dxc -enable-16bit-types -T lib_6_4 /HV 2021 %s 2>&1 -###   | FileCheck -check-prefix=valid %s
+
+
+// both_invalid: error: enable-16bit-types option only valid when target shader model [-T] is >= 6.2 and HLSL Version [-HV] is >= 2021
+// HV_invalid: error: enable-16bit-types option only valid when target shader model [-T] is >= 6.2 and HLSL Version [-HV] is >= 2021
+// TP_invalid: error: enable-16bit-types option only valid when target shader model [-T] is >= 6.2 and HLSL Version [-HV] is >= 2021
----------------
bogner wrote:

It might be nice to parameterize the diagnostic here to just point out which thing is wrong rather than list the full set of requirements. Something like:
> "16-bit types are only valid for %select{shader model 6.2|HLSL version 2021}0 and above, but this is '%1'"

WDYT?

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


More information about the cfe-commits mailing list