[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

Xiang Li via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 20:15:41 PST 2024


================
@@ -226,6 +226,47 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
       A->claim();
       continue;
     }
+    if (A->getOption().getID() == options::OPT_dxc_hlsl_version) {
+      // Translate -HV into -std for llvm
+      // depending on the value given
+      llvm::StringRef value(A->getValue());
+      llvm::StringRef acceptedValues(
+          Opts.getOptionValues(options::OPT_dxc_hlsl_version));
+      llvm::SmallVector<StringRef, 8> validValues;
+      acceptedValues.split(validValues, ", ");
+      if (value == validValues[0]) {
----------------
python3kgae wrote:

Why not just check value == "2016" here so we don't need to getOptionValues?
And the code will be easier to understand.

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


More information about the cfe-commits mailing list