[PATCH] D86089: Add experimental flang driver and frontend with help screen

Caroline via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 09:20:10 PDT 2020


CarolineConcatto created this revision.
Herald added subscribers: llvm-commits, cfe-commits, dang, usaxena95, kadircet, hiraditya, mgorny.
Herald added a reviewer: DavidTruby.
Herald added a reviewer: sscalpone.
Herald added projects: clang, LLVM.
CarolineConcatto requested review of this revision.
Herald added a subscriber: ilya-biryukov.

This is the first patch implementing the new Flang driver as outlined in [1],
[2] & [3]. It created Flang driver (`flang-new` and Flang frontend driver
(`flang-new -fc1`) with help screen(`-help`) and version(`--version`) options.
These will be renamed as `flang` and `flang -fc1` once the current Flang
throwaway driver, `flang`, can be replaced

`flang-new` is implemented in terms of libclangDriver, defaulting the driver
mode to `flang` (added to libclangDriver in [2]). This ensures that the driver
runs in flang mode regardless of the name of the binary inferred from argv[0].

The design of the new flang compiler and frontend drivers is inspired by it
counterparts in Clang [3]. Currently, the new flang compiler and frontend
drivers re-use Clang libraries: clangBasic, clangDriver and clangFrontend.
To identify Flang options, this patch adds FlangOption enum. printHelp is
updated so that `flang-new` prints only Flang options.

The new Flang driver is disabled by default. To build it, set
'-DBUILD_FLANG_NEW_DRIVER =ON' when configuring Flang and LLVM_ENABLE_PROJECTS
with clang.

[1] RFC: new Flang driver - next steps
http://lists.llvm.org/pipermail/flang-dev/2020-July/000470.html
[2] "RFC: Adding a fortran mode to the clang driver for flang"
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062669.html
[3]RFC: refactoring libclangDriver/libclangFrontend to share with Flan
http://lists.llvm.org/pipermail/cfe-dev/2020-July/066393.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86089

Files:
  clang/include/clang/Driver/Driver.h
  clang/include/clang/Driver/Options.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Flang.cpp
  clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/test/Driver/flang/flang.f90
  clang/test/Driver/flang/flang_ucase.F90
  clang/test/Driver/flang/multiple-inputs-mixed.f90
  clang/test/Driver/flang/multiple-inputs.f90
  clang/unittests/Driver/SanitizerArgsTest.cpp
  clang/unittests/Driver/ToolChainTest.cpp
  flang/CMakeLists.txt
  flang/include/flang/Frontend/CompilerInstance.h
  flang/include/flang/Frontend/CompilerInvocation.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/include/flang/FrontendTool/Utils.h
  flang/lib/CMakeLists.txt
  flang/lib/Frontend/CMakeLists.txt
  flang/lib/Frontend/CompilerInstance.cpp
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendOptions.cpp
  flang/lib/FrontendTool/CMakeLists.txt
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/test/CMakeLists.txt
  flang/test/Flang-Driver/driver-error-cc1.c
  flang/test/Flang-Driver/driver-error-cc1.cpp
  flang/test/Flang-Driver/driver-error-diagnostic.f90
  flang/test/Flang-Driver/driver-help.f90
  flang/test/Flang-Driver/driver-version.f90
  flang/test/lit.cfg.py
  flang/test/lit.site.cfg.py.in
  flang/tools/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  flang/tools/flang-driver/driver.cpp
  flang/tools/flang-driver/fc1_main.cpp
  flang/unittests/CMakeLists.txt
  flang/unittests/Frontend/CMakeLists.txt
  flang/unittests/Frontend/CompilerInstanceTest.cpp
  llvm/lib/Option/OptTable.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86089.286047.patch
Type: text/x-patch
Size: 47927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200817/49491a46/attachment-0001.bin>


More information about the cfe-commits mailing list