llvm-project/clang/lib/Driver/ToolChains
Faris Rehman 3a1513c142 [flang][driver] Add forced form flags and -ffixed-line-length
Add support for the following layout options:
* -ffree-form
* -ffixed-form
- -ffixed-line-length=n (alias -ffixed-line-length-n)
Additionally remove options `-fno-free-form` and `-fno-fixed-form` as they were initially added to forward to gfortran but gfortran does not support these flags.

This patch adds the flag FlangOnlyOption to the existing options `-ffixed-form`, `-ffree-form` and `-ffree-line-length-` in Options.td. As of commit 6a75496836, these flags are not currently forwarded to gfortran anyway.

The default fixed line length in FrontendOptions is 72, based off the current default in Fortran::parser::Options. The line length cannot be set to a negative integer, or a positive integer less than 7 excluding 0, consistent with the behaviour of gfortran.

This patch does not add `-ffree-line-length-n` as Fortran::parser::Options does not have a variable for free form columns.
Whilst the `fixedFormColumns` variable is used in f18 for `-ffree-line-length-n`, f18 only allows `-ffree-line-length-none`/`-ffree-line-length-0` and not a user-specified value. `fixedFormcolumns` cannot be used in the new driver as it is ignored in the frontend when dealing with free form files.

Summary of changes:
- Remove -fno-fixed-form and -fno-free-form from Options.td
- Make -ffixed-form, -ffree-form and -ffree-line-length-n FlangOnlyOption in Options.td
- Create AddFortranDialectOptions method in Flang.cpp
- Create FortranForm enum in FrontendOptions.h
- Add fortranForm_ and fixedFormColumns_ to Fortran::frontend::FrontendOptions
- Update fixed-form-test.f so that it guarantees that it fails when forced as a free form file to better facilitate testing.

Differential Revision: https://reviews.llvm.org/D95460
2021-02-04 12:24:15 +00:00
..
Arch [RISCV] Update the version number to v0.10 for vector. 2021-01-30 07:20:05 +08:00
AIX.cpp [clang][driver] Fix definition/declaration argument name mismatches. NFCI. 2020-11-17 12:39:45 +00:00
AIX.h [clang][driver][AIX] Set compiler-rt as default rtlib 2020-09-28 19:45:43 -04:00
AMDGPU.cpp [hip] Fix HIP version parsing. 2021-01-06 17:00:14 -05:00
AMDGPU.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AMDGPUOpenMP.cpp [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AMDGPUOpenMP.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AVR.cpp [clang][AVR][NFC] Fix a typo 2021-02-03 20:00:06 +08:00
AVR.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Ananas.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Ananas.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
BareMetal.cpp Add initial support for multilibs in Baremetal toolchain. 2020-12-14 20:49:45 +00:00
BareMetal.h Add initial support for multilibs in Baremetal toolchain. 2020-12-14 20:49:45 +00:00
Clang.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
Clang.h [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
CloudABI.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
CloudABI.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
CommonArgs.cpp [CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker. 2021-02-02 09:43:57 -08:00
CommonArgs.h [Driver][MachineOutliner] Support outlining option with LTO 2021-01-06 16:01:38 +01:00
Contiki.cpp
Contiki.h
CrossWindows.cpp [clang][driver] Fix definition/declaration argument name mismatches. NFCI. 2020-11-17 12:39:45 +00:00
CrossWindows.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
Cuda.cpp [OpenMP][deviceRTLs] Build the deviceRTLs with OpenMP instead of target dependent language 2021-01-26 12:28:47 -05:00
Cuda.h [DWARF] Allow toolchain to adjust specified DWARF version. 2020-12-09 16:34:34 -08:00
Darwin.cpp [Triple][MachO] Define "arm64e", an AArch64 subarch for Pointer Auth. 2020-12-03 07:53:59 -08:00
Darwin.h clang: Pass -platform-version to new MachO LLD 2020-11-24 11:16:03 -05:00
DragonFly.cpp [clang] update of the DragonFlyBSD's driver for the 5.8.x releases 2020-10-19 14:04:49 +01:00
DragonFly.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Flang.cpp [flang][driver] Add forced form flags and -ffixed-line-length 2021-02-04 12:24:15 +00:00
Flang.h [flang][driver] Add forced form flags and -ffixed-line-length 2021-02-04 12:24:15 +00:00
FreeBSD.cpp [PowerPC] Support powerpcle target in Clang [3/5] 2021-01-02 12:17:58 -06:00
FreeBSD.h Fix regression due to test hip-version.hip 2020-07-11 12:45:29 -04:00
Fuchsia.cpp [clang][Fuchsia] Add relative-vtables + asan multilibs 2021-01-25 15:24:16 -08:00
Fuchsia.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
Gnu.cpp clang: Always pass PowerPC endian information to GNU as 2021-01-11 14:50:28 -08:00
Gnu.h [Driver] Filter out <libdir>/gcc and <libdir>/gcc-cross if they do not exists 2020-09-29 09:18:50 +03:00
HIP.cpp [AMDGPU] add -mcode-object-version=n 2020-12-07 18:08:37 -05:00
HIP.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
Haiku.cpp
Haiku.h
Hexagon.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Hexagon.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Hurd.cpp [Driver] Search computed sysroot for libc++ header paths 2020-06-17 16:17:37 -07:00
Hurd.h [Driver] Search computed sysroot for libc++ header paths 2020-06-17 16:17:37 -07:00
InterfaceStubs.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
InterfaceStubs.h [clang][ifs] Clang Interface Stubs ToolChain plumbing. 2019-10-08 15:23:14 +00:00
Lanai.h
Linux.cpp [LSan][RISCV] Enable LSan for RISCV64 2021-01-31 21:53:25 +00:00
Linux.h [AArch64][Clang][Linux] Enable out-of-line atomics by default. 2021-01-29 17:44:45 +00:00
MSP430.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
MSP430.h [MSP430] Actualize the toolchain description 2020-07-17 15:42:12 +03:00
MSVC.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
MSVC.h [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
MSVCSetupApi.h
MinGW.cpp [clang] [MinGW] Allow using the vptr sanitizer 2020-11-03 09:59:09 +02:00
MinGW.h Fix regression due to test hip-version.hip 2020-07-11 12:45:29 -04:00
Minix.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Minix.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
MipsLinux.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
MipsLinux.h
Myriad.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Myriad.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
NaCl.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
NaCl.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
NetBSD.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
NetBSD.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
OpenBSD.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
OpenBSD.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
PPCLinux.cpp [PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers 2019-07-30 02:18:11 +00:00
PPCLinux.h
PS4CPU.cpp Reland - [Clang] Add the ability to map DLL storage class to visibility 2020-11-02 23:24:49 +00:00
PS4CPU.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
RISCVToolchain.cpp [clang][Driver] Handle risvc in Baremetal.cpp. 2020-11-26 11:43:17 +00:00
RISCVToolchain.h [clang][Driver] Handle risvc in Baremetal.cpp. 2020-11-26 11:43:17 +00:00
ROCm.h [hip] Fix HIP version parsing. 2021-01-06 17:00:14 -05:00
Solaris.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Solaris.h [clang][Driver] Default to /usr/bin/ld on Solaris 2020-08-13 22:42:58 +02:00
TCE.cpp
TCE.h
VEToolchain.cpp [VE] Add standard include path and library path for C++ 2020-12-03 22:22:56 +09:00
VEToolchain.h [VE] Change to use integrated assembly by defualt 2020-10-30 00:16:04 +09:00
WebAssembly.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
WebAssembly.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
XCore.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
XCore.h
ZOS.cpp [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS 2020-09-16 14:49:03 -04:00
ZOS.h [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS 2020-09-16 14:49:03 -04:00