Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

[flang][driver] Add PrescanAction frontend action (nfc)

Authored by awarzynski on Jan 26 2021, 11:22 AM.



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.

Diff Detail

Event Timeline

awarzynski requested review of this revision.Jan 26 2021, 11:22 AM
awarzynski created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2021, 11:22 AM
FarisRehman accepted this revision.Feb 4 2021, 5:02 AM

Thanks for working on this @awarzynski, this patch allows actions that do not need to run the prescanner to not do so.
I've left a nit, but otherwise LRTM!


[nit] Update this comment to reflect the move of this line from the loop into this method, e.g. removing mention of the loop like Ideally we should have all Fortran options set before processing any input files.?

This revision is now accepted and ready to land.Feb 4 2021, 5:02 AM
This revision was landed with ongoing or failed builds.Feb 4 2021, 6:24 AM
This revision was automatically updated to reflect the committed changes.