This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Move fixed/free from detection out of FrontendAction API
ClosedPublic

Authored by awarzynski on Jan 20 2021, 6:16 AM.

Details

Summary

All Fortran options should be set in CompilerInvocation before any of
FrontendActions is entered - that's the job of the driver. However, this
is a bit tricky with fixed and....free from detection introduced in
https://reviews.llvm.org/D94228.

Basically, fixed-free form detection needs to happen:

  • separately for every input file (we might be compiling multiple Fortran files, some in free form, some in fixed form)
  • before any frontend action (we need to specify isFixedForm in Fortran::parser::Options first)

In other words, we need this to happen early (before any
FrontendAction), but not too early (we need to know what the current
input file is). Ideally we would be able to set all Fortran options in
one place, but currently that's not possible.

All changes in this patch are NFCs (hence no new tests). Below is a

  • move fixed/free form detection from FrontendAction::ExecuteAction to CompilerInstance::ExecuteAction
  • add a bool flag in FrontendInputFile to mark a file as fixed/free form
  • updated a few comments

Diff Detail

Event Timeline

awarzynski requested review of this revision.Jan 20 2021, 6:16 AM
awarzynski created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2021, 6:16 AM
awarzynski retitled this revision from [flang][driver] Move fixed/free from detection out of FrontendAction API All Fortran options should be set in CompilerInvocation before any of FrontendActions is entered - that's the job of the driver. However, this is a bit tricky with fixed and... to [flang][driver] Move fixed/free from detection out of FrontendAction API.Jan 20 2021, 6:18 AM
awarzynski edited the summary of this revision. (Show Details)
awarzynski added a project: Restricted Project.
FarisRehman accepted this revision.Jan 20 2021, 9:33 AM

Thanks for working on this @awarzynski

LGTM!

This revision is now accepted and ready to land.Jan 20 2021, 9:33 AM
This revision was landed with ongoing or failed builds.Jan 21 2021, 8:57 AM
This revision was automatically updated to reflect the committed changes.