[flang-commits] [clang] [flang] [flang][Driver] Support -print-supported-cpus and associated aliases (PR #117199)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Thu Nov 21 10:58:59 PST 2024


================
@@ -4417,7 +4417,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
 
       // Use the -mcpu=? flag as the dummy input to cc1.
       Actions.clear();
-      Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C);
+      Action *InputAc = C.MakeAction<InputAction>(
+          *A, IsFlangMode() ? types::TY_Fortran : types::TY_C);
----------------
tarunprabhu wrote:

This is actually needed. 

The `-mcpu=help` argument is used as a "dummy input" (there is a comment a few lines above that says as much). 
The input action created here eventually gets used in `ShouldUseFlangCompiler` which checks if the input type is accepted by `flang`. `flang` does not accept inputs of type `TY_C` (even if they are "dummies"). If `ShouldUseFlangCompiler` returns `false`, a `cc1` command line is created - which is, obviously, not correct.

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


More information about the flang-commits mailing list