[PATCH] D157837: [flang][driver] Update the visibility of Clang options in Flang

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 00:40:18 PDT 2023


awarzynski created this revision.
awarzynski added a reviewer: bogner.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
awarzynski requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, jplehr, sstefan1, jdoerfert, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Prior to D157151 <https://reviews.llvm.org/D157151>, there was no mechanism to "disable" unsupported Clang
options in Flang. While the "help" text (`flang-new -help`) was indeed
configured not to display such options, the Flang compiler driver would
happily consume such options and only issue a warning when there was no
logic to parse it:

  flang-new -fno-experimental-relative-c++-abi-vtables file.f90
  flang-new: warning: argument unused during compilation: '-fno-experimental-relative-c++-abi-vtables'

D157151 <https://reviews.llvm.org/D157151> introduces visibility flags. In particular, all Clang options
gain a visibility flag (`Default`) that can be excluded when in Flang
driver mode. This way the above invocation will lead to:

  flang-new: error: unknown argument '-fno-experimental-relative-c++-abi-vtables'; did you mean '-Xclang -fno-experimental-relative-c++-abi-vtables'?

This won't work unless all options/flags supported by Flang have their
visibility flags updated accordingly, hence the changes in Options.td.
Moving forward, this change will allow Flang better control over the
supported options.

Depends on D157151 <https://reviews.llvm.org/D157151>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157837

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/fast_math.f90
  flang/test/Driver/target-cpu-features.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157837.549810.patch
Type: text/x-patch
Size: 65025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/9a99e807/attachment-0001.bin>


More information about the cfe-commits mailing list