================
@@ -574,18 +606,31 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, 
StringRef BoundArch,
   return DAL;
 }
 
-bool HLSLToolChain::requiresValidation(DerivedArgList &Args) const {
-  if (!Args.hasArg(options::OPT_dxc_Fo))
+bool HLSLToolChain::requiresValidation(DerivedArgList &Args,
+                                       bool Diagnose) const {
+  bool HasFo = Args.hasArg(options::OPT_dxc_Fo);
+  bool DisableValidation =
+      Args.getLastArg(options::OPT_dxc_disable_validation) != nullptr;
+
+  if (DisableValidation || !HasFo)
     return false;
 
-  if (Args.getLastArg(options::OPT_dxc_disable_validation))
+  if (getArch() == llvm::Triple::dxil) {
+    std::string DxvPath = GetProgramPath("dxv");
+    if (DxvPath != "dxv")
+      return true;
+
+    if (Diagnose)
+      getDriver().Diag(diag::warn_drv_dxc_missing_dxv);
     return false;
+  }
 
-  std::string DxvPath = GetProgramPath("dxv");
-  if (DxvPath != "dxv")
+  std::string SpirvValPath = GetProgramPath("spirv-val");
+  if (SpirvValPath != "spirv-val")
     return true;
 
-  getDriver().Diag(diag::warn_drv_dxc_missing_dxv);
+  if (Diagnose)
+    getDriver().Diag(diag::warn_drv_dxc_missing_spirv_val);
----------------
bogner wrote:

We should gate the spirv-val checks here behind a check for SPIR-V. If we were 
to target something other than dxil or spir-v this wouldn't be correct.

https://github.com/llvm/llvm-project/pull/188150
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to