[all-commits] [llvm/llvm-project] aba24c: [flang][driver] Move fixed/free from detection out...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Thu Jan 21 08:57:55 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aba24c1580cfafc387d94add3855cb4a1e90db3c
      https://github.com/llvm/llvm-project/commit/aba24c1580cfafc387d94add3855cb4a1e90db3c
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2021-01-21 (Thu, 21 Jan 2021)

  Changed paths:
    M flang/include/flang/Frontend/FrontendOptions.h
    M flang/lib/Frontend/CompilerInstance.cpp
    M flang/lib/Frontend/FrontendAction.cpp

  Log Message:
  -----------
  [flang][driver] Move fixed/free from detection out of FrontendAction API

All Fortran options should be set in `CompilerInstance` (via its
`CompilerInvocation`) before any of `FrontendAction` is entered -
that's one of the tasks of the driver. However, this is a bit tricky
with fixed and free from detection introduced in
https://reviews.llvm.org/D94228.

Fixed-free form detection needs to happen:
  * before any frontend action (we need to specify `isFixedForm` in
    `Fortran::parser::Options` before running any actions)
  * separately for every input file (we might be compiling multiple
    Fortran files, some in free form, some in fixed form)
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). In practice, `isFixedForm` can only be set later
than other options (other options are inferred from compiler flags). So
we can't really set all of them in one place, which is not ideal.

All changes in this patch are NFCs (hence no new tests). Quick summary:
  * 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

Differential Revision: https://reviews.llvm.org/D95042




More information about the All-commits mailing list