This patch introduces the dependencies required to read and manage input files
provided by the command line option. It also adds the structure 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, e.g.
flang-new -test-io or flang-new -fc1 -test-io
With this patch, flang-new -test-io input-file.f90 will read input-file.f90 and
print it in the output file.
The InputOutputTest action has been introduced to facilitate testing. It is
hidden from users, not being shown with --help. It is visible with
--help-hidden, and only available for FlangOption and FC1Options in Option.td.
Currently Clang doesn’t have an equivalent action.
-test-io is used to trigger the InputOutputTest action in the Flang frontend
driver. This patch also 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 so that the preprocessor is
_not_ run in the frontend driver. This is the desired behaviour: -test-io will
only read the input file and print it to the output stream.