[all-commits] [llvm/llvm-project] d28de0: [Flang][Driver] Add PrintPreprocessedInput Fronten...

CarolineConcatto via All-commits all-commits at lists.llvm.org
Mon Nov 2 06:03:58 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d28de0d7f257bbe4703f3449f1672f1744cf306b
      https://github.com/llvm/llvm-project/commit/d28de0d7f257bbe4703f3449f1672f1744cf306b
  Author: Caroline Concatto <caroline.concatto at arm.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M flang/include/flang/Frontend/CompilerInstance.h
    M flang/include/flang/Frontend/CompilerInvocation.h
    M flang/include/flang/Frontend/FrontendActions.h
    M flang/include/flang/Frontend/FrontendOptions.h
    M flang/lib/Frontend/CompilerInstance.cpp
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendAction.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    M flang/test/Flang-Driver/driver-help-hidden.f90
    M flang/test/Flang-Driver/driver-help.f90
    A flang/test/Frontend/Inputs/hello-world.c
    A flang/test/Frontend/print-preprocess-C-file.f90
    A flang/test/Frontend/print-preprocessed-file.f90
    M flang/unittests/Frontend/CMakeLists.txt
    A flang/unittests/Frontend/PrintPreprocessedTest.cpp

  Log Message:
  -----------
  [Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)

This patch implements the first frontend action for the Flang parser (i.e.
Fortran::parser). This action runs the preprocessor and is invoked with the
`-E` flag. (i.e. `flang-new -E <input-file>). The generated output is printed
to either 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 Flang 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 at arm.com>

Differential Revision: https://reviews.llvm.org/D88381




More information about the All-commits mailing list