llvm-project/clang/lib/Driver
Caroline Concatto 4c5906cffd [Flang][Driver] Add infrastructure for basic frontend actions and file I/O
This patch introduces the dependencies required to read and manage input files
provided by the command line option. It also adds the infrastructure to create
and write to output files. The output is sent to either stdout or a file
(specified with the `-o` flag).

Separately, in order to be able to test the code for file I/O, it adds
infrastructure to create frontend actions. As a basic testable example, it adds
the `InputOutputTest` FrontendAction. The sole purpose of this action is to
read a file from the command line and print it either to stdout or the output
file.  This action is run by using the `-test-io` flag also introduced in this
patch (available for `flang-new` and `flang-new -fc1`). With this patch:
```
flang-new -test-io input-file.f90
```
will read input-file.f90 and print it in the output file.

The `InputOutputTest` frontend action has been introduced primarily to
facilitate testing. It is hidden from users (i.e. it's only displayed with
`--help-hidden`). Currently Clang doesn’t have an equivalent action.

`-test-io` is used to trigger the InputOutputTest action in the Flang frontend
driver. This patch makes sure that “flang-new” forwards it to “flang-new -fc1"
by creating a preprocessor job. However, in Flang.cpp, `-test-io` is passed to
“flang-new -fc1” without `-E`. This way we make sure that the preprocessor is
_not_ run in the frontend driver. This is the desired behaviour: `-test-io`
should only read the input file and print it to the output stream.

co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>

Differential Revision: https://reviews.llvm.org/D87989
2020-10-24 14:58:32 +01:00
..
ToolChains [Flang][Driver] Add infrastructure for basic frontend actions and file I/O 2020-10-24 14:58:32 +01:00
Action.cpp Add Statically Linked Libraries 2020-06-22 19:48:49 +00:00
CMakeLists.txt [SystemZ][z/OS] Adding initial toolchain for z/OS 2020-09-01 10:15:01 -04:00
Compilation.cpp [CUDA][HIP] Add -Xarch_device and -Xarch_host options 2020-03-24 10:13:05 -04:00
DarwinSDKInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Distro.cpp [Driver] Perform Linux distribution detection only once 2020-09-26 08:44:08 +03:00
Driver.cpp [Flang][Driver] Add infrastructure for basic frontend actions and file I/O 2020-10-24 14:58:32 +01:00
DriverOptions.cpp [Driver] Use shared singleton instance of DriverOptTable 2019-09-04 14:26:28 +00:00
InputInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Job.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Multilib.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
OptionUtils.cpp [NFC] Move OptionUtils from Basic to Driver 2019-12-23 08:11:23 -05:00
Phases.cpp [clang][ifs] Clang Interface Stubs ToolChain plumbing. 2019-10-08 15:23:14 +00:00
SanitizerArgs.cpp Driver: Add integer sanitizers to trapping group automatically. 2020-10-20 13:45:39 -07:00
Tool.cpp Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
ToolChain.cpp [Driver] Incorporate -mfloat-abi in the computed triple on ARM 2020-10-21 11:19:38 +01:00
Types.cpp [Flang][Driver] Add infrastructure for basic frontend actions and file I/O 2020-10-24 14:58:32 +01:00
XRayArgs.cpp [xray] Function coverage groups 2020-09-24 22:09:53 -04:00