https://github.com/mh4ck-Thales created 
https://github.com/llvm/llvm-project/pull/100321

Add a warning when `wasm-opt` is requested with a flag (#95208) but is not 
found in the path.

I'm using #77148 as reference on how to add a new warning but please tell me if 
you can help in implementing this. Also I'm not sure in which warning group 
include this, at first glance none seem relevant for this specific problem. 

Regarding https://github.com/llvm/llvm-project/pull/98373 another warning might 
be relevant if people target WASIp2+ and try to use wasm-opt explicitly. This 
can be grouped in one warning "wasm-opt not available in this context" or 
separated in 2 for clearer error messages. WDYT?

CC @sunfishcode @sbc100 @alexcrichton 

>From 6a74d3a93d595592ee97120ad60a6c262a2c4d29 Mon Sep 17 00:00:00 2001
From: Quentin Michaud <quentin.mich...@thalesgroup.com>
Date: Wed, 24 Jul 2024 09:54:53 +0200
Subject: [PATCH] First draft of wasm-opt warning

---
 clang/lib/Driver/ToolChains/WebAssembly.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp 
b/clang/lib/Driver/ToolChains/WebAssembly.cpp
index 9aacda5fd5702..dc49fde378a9a 100644
--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -180,6 +180,9 @@ void wasm::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
     if (WasmOptPath == "wasm-opt") {
       WasmOptPath = {};
     }
+    if (WasmOptPath.empty()) {
+      printf("warning: wasm-opt not found but was requested\n");
+    }
   }
 
   if (!WasmOptPath.empty()) {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to