[Flang][Driver] Add PrintPreprocessed FrontendAction
This patch implements the first frontend action for the Flang parser
(i.e. Fortran::parser). This action runs the preprocessor on the input
Fortran file and prints the generated output either to stdout or the
output file (specified with - or -o <output-file>).
Note that currently there is no mechanism to map options for the
frontend driver (i.e. Fortran::frontend::FrontendOptions) to options for
the parser (i.e. Fortran::parser::Options). Instead,
Frotran::parser::options are hard-coded to:
std::vector<std::string> searchDirectories{"."s}; searchDirectories = searchDirectories; isFixedForm = false; _encoding(Fortran::parser::Encoding::UTF_8);
These default settings are compatible with the current driver. Further
work is required in order for CompilerInvocation to read and map
clang::driver::options to Fortran::parser::options.
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Depends on D87989
If I am correct this seems to be an accessor member function and it should follow point 3 from flang style guide mentioned at https://github.com/llvm/llvm-project/blob/master/flang/docs/C++style.md#naming
I am not aware if driver related patches follow llvm-project style.