[PATCH] D95464: [flang][driver] Add PrescanAction frontend action (nfc)

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 11:22:12 PST 2021


awarzynski created this revision.
awarzynski requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This new action encapsulates all actions that require the prescanner to
be run before proceeding with other processing. By adding this new
action, we are better equipped to control which actions _do_ run the
prescanner and which _do not_.

The following actions that require the prescanner are refactored to
inherit from `PrescanAction`:

- `PrintPreprocessedAction`
- `ParseSyntaxOnlyAction` .

New virtual method is introduced to facilitate all this:

- `BeginSourceFileAction`

Like in Clang, this method is run inside `BeginSrouceFile`. In other
words, it is invoked before `ExecuteAction` for the corresponding
frontend action is run. This method allows us to:

- carry out any processing that is always required by the action (e.g. run the prescanner)
- fine tune the settings/options on a file-by-file basis (e.g. to decide between fixed-form and free-form based on file extension)

This patch implements non-functional-changes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95464

Files:
  flang/include/flang/Frontend/FrontendAction.h
  flang/include/flang/Frontend/FrontendActions.h
  flang/lib/Frontend/CompilerInstance.cpp
  flang/lib/Frontend/FrontendAction.cpp
  flang/lib/Frontend/FrontendActions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95464.319365.patch
Type: text/x-patch
Size: 5712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210126/dde849c3/attachment.bin>


More information about the llvm-commits mailing list