[flang-commits] [clang] [flang] [flang] Do not hardcode "flang" in the driver (PR #200438)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Mon Jun 15 09:48:07 PDT 2026


================
@@ -1320,7 +1320,18 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
       Input.getInputArg().renderAsInput(Args, CmdArgs);
   }
 
-  const char *Exec = Args.MakeArgString(D.GetProgramPath("flang", TC));
+  // Handle "clang --driver-mode=flang" case
+  bool isClangDriverWithFlangMode = false;
+  if (D.Name.find("clang") != std::string_view::npos) {
----------------
kkwli wrote:

I think the option is supported for `clang-cl` as well. The check will also include `clang-cl`.
https://github.com/llvm/llvm-project/blob/0919b1e54c6eff1841948717035eeffe21b27c6c/clang/include/clang/Options/Options.td#L681-L684

`--driver-mode=` supports `gcc`, `g++`, `cpp`, `cl`, `flang` and `dxc`. Currently, `flang --driver-mode=cpp`, `flang --driver-mode=g++` and `flang --driver-mode=gcc` result in:
```
error: unknown integrated tool '-cc1'. Valid tools include '-fc1'.
```
It looks like `flang --driver-mode=...` except `--driver-mode=flang` is broken or it shouldn't work. `flang --driver-mode=cpp` or `clang --driver=flang` looks strange to me. I am interested to see the use cases of it.

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


More information about the flang-commits mailing list