[PATCH] D105881: [flang][driver] Switch to `BoolFOption` for boolean options

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 13 02:48:51 PDT 2021


awarzynski created this revision.
Herald added a subscriber: dang.
awarzynski requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For boolean options, e.g. `-fxor-operator/-fno-xor-operator`, we ought
to be using TableGen multiclasses. This way, we only have to write one
definition to have both forms auto-generated. This patch refactors all of
Flang's boolean options to use the `BoolFOption` multiclass.

>From what I can see, `BoolFOption` does not support `DocString` and one
of our boolean options did specify a `DocString`. As we don't use these
fields in Flang just yet, deleting it seemed like the right approach at
this stage. We still have the "help" text to provides a brief
description.

This patch also defines a dummy `KeyPathAndMacro` to be used by Flang.
Again, we don't use this field on Flang just yet, so we defined this
dummy instance to avoid creating new TableGen multiclasses for boolean
options.

With the new approach, "empty" help text is now replaced with an empty
string. When running `flang-new --help`, that's considered as non-empty
help messages, which is then printed. This means that with this patch,
`flang-new --help` will start printing e.g. `-fno-backslash`, even
though there is no actual help text to print for this option (apart from
the emtpy string "").


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105881

Files:
  clang/include/clang/Driver/Options.td
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105881.358210.patch
Type: text/x-patch
Size: 10712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210713/79e59dae/attachment-0001.bin>


More information about the cfe-commits mailing list