This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Add extension options and -finput-charset

Authored by FarisRehman on Feb 10 2021, 4:34 AM.



Add the following options:

  • -fimplicit-none and -fno-implicit-none
  • -fbackslash and -fno-backslash
  • -flogical-abbreviations and -fno-logical-abbreviations
  • -fxor-operator and -fno-xor-operator
  • -falternative-parameter-statement
  • -finput-charset=<value>

Summary of changes:

  • Enable extensions in CompilerInvocation#ParseFrontendArgs
  • Add encoding_ to Fortran::frontend::FrontendOptions
  • Add encoding to Fortran::parser::Options

Depends on: D96344

Diff Detail

Event Timeline

FarisRehman created this revision.Feb 10 2021, 4:34 AM
FarisRehman requested review of this revision.Feb 10 2021, 4:34 AM
Herald added a project: Restricted Project. · View Herald Transcript
FarisRehman edited the summary of this revision. (Show Details)Feb 10 2021, 4:38 AM
FarisRehman added a project: Restricted Project.

Thank you for submitting this @FarisRehman !

Overall this looks good to me. I've left a few minor comments inline. Also, I think that it is worth adding a help message for -finput-charset. Lack of it in clang feels like an accidental omission. We can follow GCC here:

$ gcc --help=joined | grep input-charset
  -finput-charset=<cset>      Specify the default character set for source files.

[nit] ALWAYS is a bit unclear to me. Perhaps WITH_IMPL_NONE?


What about:

! RUN: %flang-new -fsyntax-only %s  2>&1 | FileCheck %s --allow-empty --check-prefix=DEFAULT


! RUN: %flang-new -fimplicit-none -fno-implicit-none -fsyntax-only %s  2>&1 | FileCheck %s --allow-empty --check-prefix=DEFAULT

Similar point for other tests.


[nit] This particular output might change in the future, which could make this test a bit fragile. I also think that it's not key here (IIUC, lines 27 and 30 are). Perhaps we could skip these?

1–14 ↗(On Diff #322647)

Could this be merged with pipeline.f90 from (btw, IMHO it is worth renaming that file)

FarisRehman marked 2 inline comments as done.

Address review comment

This revision addresses a review comment by @awarzynski

Summary of changes:

  • Rebase off the latest D96344 revision
  • Add a help message to -finput-charset
  • Remove unnecessary test CHECK lines

The first test is already present, and I have now modified the -fno-implicit-none test to specify -fimplicit-none before it to show the behaviour more clearly.

FarisRehman edited the summary of this revision. (Show Details)Feb 15 2021, 5:13 AM
awarzynski accepted this revision.Feb 15 2021, 9:49 AM

Thank you for addressing my comments. LGTM!

Please add missing newline chars before merging ;-)

This revision is now accepted and ready to land.Feb 15 2021, 9:49 AM

Rebase off main

Rebase off main and remove dependency on patch D96344.

This revision was landed with ongoing or failed builds.Feb 16 2021, 3:27 AM
This revision was automatically updated to reflect the committed changes.