[clang] [flang] [Flang] Adding -ffree-line-length-<value> flag (PR #192941)
Andre Kuhlenschmidt via cfe-commits
cfe-commits at lists.llvm.org
Fri May 1 12:41:40 PDT 2026
================
@@ -808,27 +808,34 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
: FortranForm::FreeForm;
}
- // Set fixedFormColumns based on -ffixed-line-length=<value>
+ // Set fixedFormColumns based on -ffixed-line-length=<value> or
+ // set freeFormColumns based on -ffree-line-length=<value>.
if (const auto *arg =
- args.getLastArg(clang::options::OPT_ffixed_line_length_EQ)) {
+ args.getLastArg(clang::options::OPT_ffixed_line_length_EQ,
+ clang::options::OPT_ffree_line_length_EQ)) {
----------------
akuhlens wrote:
@JDPailleux please add tests for the following two invocations. My fear here is that we may be dropping one of these flags on the floor based on argument order, I think the second one should fail with the current implementation, but since there is no test for this it is hard to tell. It would be my preference that even if this code is correct it would be simplified so that it is easier to tell it is correct, but this could just be me being slower than everyone else in the room. I personally would have just written this code as two consecutive if statements that do about the same thing, one for each flag, if I needed to share code between them I would abstract that code into one or more functions.
```
flang -ffixed-line-length=72 -ffree-line-length=500 free-file-that-would-be-wrong-with-default.f90
flang -ffree-line-length=500 -ffixed-line-length=72 free-file-that-would-be-wrong-with-default.f90
```
https://github.com/llvm/llvm-project/pull/192941
More information about the cfe-commits
mailing list