[all-commits] [llvm/llvm-project] 4c5906: [Flang][Driver] Add infrastructure for basic front...

CarolineConcatto via All-commits all-commits at lists.llvm.org
Sat Oct 24 06:58:56 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c5906cffd04202387d2f6b50a47d39c0e4f2c0e
      https://github.com/llvm/llvm-project/commit/4c5906cffd04202387d2f6b50a47d39c0e4f2c0e
  Author: Caroline Concatto <caroline.concatto at arm.com>
  Date:   2020-10-24 (Sat, 24 Oct 2020)

  Changed paths:
    M clang/include/clang/Driver/Options.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Driver/Types.cpp
    M clang/test/Driver/immediate-options.c
    M flang/include/flang/Frontend/CompilerInstance.h
    M flang/include/flang/Frontend/CompilerInvocation.h
    A flang/include/flang/Frontend/FrontendAction.h
    A flang/include/flang/Frontend/FrontendActions.h
    M flang/include/flang/Frontend/FrontendOptions.h
    M flang/include/flang/FrontendTool/Utils.h
    M flang/lib/Frontend/CMakeLists.txt
    M flang/lib/Frontend/CompilerInstance.cpp
    M flang/lib/Frontend/CompilerInvocation.cpp
    A flang/lib/Frontend/FrontendAction.cpp
    A flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/Frontend/FrontendOptions.cpp
    M flang/lib/FrontendTool/CMakeLists.txt
    M flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    A flang/test/Flang-Driver/driver-help-hidden.f90
    M flang/test/Flang-Driver/driver-help.f90
    M flang/test/Flang-Driver/emit-obj.f90
    A flang/test/Frontend/Inputs/hello-world.f90
    A flang/test/Frontend/input-output-file.f90
    A flang/test/Frontend/multiple-input-files.f90
    M flang/test/lit.cfg.py
    M flang/tools/flang-driver/fc1_main.cpp
    M flang/unittests/Frontend/CMakeLists.txt
    M flang/unittests/Frontend/CompilerInstanceTest.cpp
    A flang/unittests/Frontend/InputOutputTest.cpp

  Log Message:
  -----------
  [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 at arm.com>

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




More information about the All-commits mailing list