Page MenuHomePhabricator

[flang][nfc] Tweak the FrontendAction class
ClosedPublic

Authored by awarzynski on Aug 16 2021, 7:38 AM.

Details

Summary

This patch refactors the FrontendAction class. It merely moves code
around so that re-using it is easier. No new functionality is
introduced.

  1. Three new member methods are introduced: RunPrescan, RunParse,

RunSema.

  1. The following free functions are re-implemented as member methods:
    • reportFatalSemanticErrors
    • reportFatalScanningErrors
    • reportFatalParsingErrors
    • reportFatalErrors

reportFatalSemanticErrors is updated to resemble the other error
reporting functions and to make the API more consistent.

  1. The BeginSourceFileAction methods are simplified and the unused

input argument is deleted.

Diff Detail

Event Timeline

awarzynski requested review of this revision.Aug 16 2021, 7:38 AM
awarzynski created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2021, 7:38 AM
awarzynski added a project: Restricted Project.
ashermancinelli accepted this revision.Aug 16 2021, 10:14 AM
ashermancinelli added inline comments.
flang/lib/Frontend/FrontendAction.cpp
159

[nit] Would it be too invasive to expand this name in this patch, eg RunSemanticAction or something else more verbose?

This revision is now accepted and ready to land.Aug 16 2021, 10:14 AM
awarzynski added inline comments.Aug 16 2021, 10:23 AM
flang/lib/Frontend/FrontendAction.cpp
159

RunSema is a poor name, thanks for complaining :)

I'd rather avoid using Action here as this method does not correspond to a particular FrontendAction. Instead, it will be used by multiple specialisations of that class. Let me rename it as RunSemanticChecks.

Rename RunSema as RunSemanticChecks

flang/lib/Frontend/FrontendAction.cpp
159

Looks great!

This revision was automatically updated to reflect the committed changes.