[PATCH] D99645: [flang][driver] Add debug options not requiring semantic checks

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 31 02:45:21 PDT 2021


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

This patch adds two debugging options in the new Flang driver
(`flang-new`):

- `-fdebug-unparse-no-sema`
- `-fdebug-dump-parse-tree-no-sema`

Each of these options combines two options from the "throwaway"
driver (left: `f18`, right: `flang-new`):

- `-fdebug-uparse -fdebug-no-semantics` --> `-fdebug-unparse-no-sema`
- `-fdebug-dump-parse-tree -fdebug-no-semantics` --> `-fdebug-dump-parse-tree-no-sema`

There are no plans to implement `-fdebug-no-semantics` in the new
driver. Such option is deemed too powerful. Also, it only makes sense
when combined with specific frontend actions (`-fdebug-unparse` and
`-fdebug-dump-parse-tree`). Instead,

- dedicated `FrontendAction`s (available in the new driver), and
- specialised action options

feel like a much safer and future-proof approach.

In terms of the implementation, new actions are introduced via a new
abstract frontend action: `PrescanAndParseAction`. This action will only

- run the prescanner and the parser.

Until now, we've only had actions that would:

- only run the prescanner (`PrescanAction`)
- run the prescanner, parser and do the semantic checks (`PrescanAndSemaAction`)

New actions require finer granularity, hence the new abstract class.
Apart from the semantic checks removed at the end, the implementation of
`PrescanAndParseAction::BeginSourceFileAction` is similar to
`PrescanAndSemaAction::BeginSourceFileAction`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99645

Files:
  clang/include/clang/Driver/Options.td
  flang/include/flang/Frontend/FrontendActions.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/test/Parser/omp-allocate-unparse.f90
  flang/test/Parser/omp-atomic-unparse.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99645.334389.patch
Type: text/x-patch
Size: 9605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210331/7ff7cc97/attachment.bin>


More information about the cfe-commits mailing list