[PATCH] D96483: [flang][driver] Add options for unparsing

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 02:59:23 PST 2021


awarzynski created this revision.
Herald added subscribers: dang, mgorny.
Herald added a reviewer: sscalpone.
Herald added a reviewer: jansvoboda11.
awarzynski requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds the following compiler frontend driver options:

- -fdebug-unparse (f18 spelling: -funparse)
- -fdebug-unparse-with-symbols (f18 spelling: -funparse-with-symbols)

The new driver will only accept the new spelling. `f18` will accept both
the original and the new spelling.

A new base class for frontend actions is added: `PrescanAndSemaAction`.
This is added to reduce code duplication that otherwise these new
options would lead to. Implementation from

- `ParseSyntaxOnlyAction::ExecutionAction`

is moved to:

- `PrescanAndSemaAction::BeginSourceFileAction`

This implementation is now shared between:

- PrescanAndSemaAction
- ParseSyntaxOnlyAction
- DebugUnparseAction
- DebugUnparseWithSymbolsAction

All tests that don't require other yet unimplemented options are
updated. This way `flang-new -fc1` is used instead of `f18` when
`FLANG_BUILD_NEW_DRIVER` is set to `On`. In order to facilitate this,
`%flang_fc1` is added in the LIT configuration (lit.cfg.py).

`asFortran` from f18.cpp is duplicated as `getBasicAsFortran` in
FrontendOptions.cpp. At this stage it's hard to find a good place to
share this method. I suggest that we revisit this once a switch from
`f18` to `flang-new` is complete.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96483

Files:
  clang/include/clang/Driver/Options.td
  flang/include/flang/Frontend/FrontendActions.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/lib/Frontend/CMakeLists.txt
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/lib/Frontend/FrontendOptions.cpp
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/lib/Parser/CMakeLists.txt
  flang/test/Flang-Driver/driver-help.f90
  flang/test/Parser/continuation-in-if.f
  flang/test/Parser/pp-dir-comments.f90
  flang/test/Semantics/canondo01.f90
  flang/test/Semantics/canondo02.f90
  flang/test/Semantics/canondo03.f90
  flang/test/Semantics/canondo04.f90
  flang/test/Semantics/canondo05.f90
  flang/test/Semantics/critical04.f90
  flang/test/Semantics/defined-ops.f90
  flang/test/Semantics/doconcurrent02.f90
  flang/test/Semantics/doconcurrent03.f90
  flang/test/Semantics/doconcurrent04.f90
  flang/test/Semantics/doconcurrent07.f90
  flang/test/Semantics/label02.f90
  flang/test/Semantics/label03.f90
  flang/test/Semantics/label04.f90
  flang/test/Semantics/label05.f90
  flang/test/Semantics/label06.f90
  flang/test/Semantics/label07.f90
  flang/test/Semantics/label08.f90
  flang/test/Semantics/label09.f90
  flang/test/Semantics/label10.f90
  flang/test/Semantics/label12.f90
  flang/test/Semantics/label13.f90
  flang/test/Semantics/label15.f90
  flang/test/lit.cfg.py
  flang/tools/f18/f18.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96483.322932.patch
Type: text/x-patch
Size: 24935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210211/c40ec153/attachment-0001.bin>


More information about the cfe-commits mailing list