[clang] [flang] [flang] Treat pre-processed input as fixed (PR #117563)
Andrzej WarzyĆski via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 07:37:11 PST 2024
================
@@ -777,6 +777,15 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
addFortranDialectOptions(Args, CmdArgs);
+ // 'flang -E' always produces output that is suitable for use as fixed form
+ // Fortran. However it is only valid free form source if the original is also
+ // free form.
+ if (InputType == types::TY_PP_Fortran &&
+ !Args.hasArg(options::OPT_ffixed_form) &&
+ !Args.hasArg(options::OPT_ffree_form)) {
----------------
banach-space wrote:
This should capture the right-most instance of `-ffixed-form`/`-ffree-form`, which is exactly what you want here:
```cpp
Args.getLastArg(clang::driver::options::OPT_ffixed_form,
clang::driver::options::OPT_ffree_form))
```
https://github.com/llvm/llvm-project/pull/117563
More information about the cfe-commits
mailing list