[all-commits] [llvm/llvm-project] 55a961: [flang][driver] Refactor boolean options
Andrzej WarzyĆski via All-commits
all-commits at lists.llvm.org
Thu Aug 5 03:21:11 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 55a96155995465416118774add8ef09c30dbebda
https://github.com/llvm/llvm-project/commit/55a96155995465416118774add8ef09c30dbebda
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2021-08-05 (Thu, 05 Aug 2021)
Changed paths:
M clang/include/clang/Driver/Options.td
M flang/lib/Frontend/CompilerInvocation.cpp
M flang/test/Driver/driver-help-hidden.f90
M flang/test/Driver/driver-help.f90
Log Message:
-----------
[flang][driver] Refactor boolean options
For boolean options, e.g. `-fxor-operator`/`-fno-xor-operator`, we ought
to be using TableGen multi-classes. 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 two new multi-classes:
`OptInFC1FFOption` and `OptOutFC1FFOption`. These multi-classes are
based on `OptInFFOption`/`OptOutFFOption`, respectively. I've also
simplified the processing of the updated options in
CompilerInvocation.cpp.
With the new approach, "empty" help text (i.e. no `HelpText`) is now
replaced with an empty string (i.e. HelpText<"">). When running
flang-new --help, that's considered as non-empty help messages, which is
then printed (that's controlled by `printHelp` from
llvm/lib/Option/OptTable.cpp). 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
empty string ""). Tests are updated accordingly.
Note that with this patch, both `-fxor-operator` and `-fno-xor-operator`
(and other boolean options refactored here) remain available in
`flang-new` and `flang-new -fc1`. In this respect, nothing changes. In a
forthcoming patch, I will refine this so that `flang-new -fc1` only
accepts `-ffoo` (`OptInFC1FFOption`) or `-fno-foo` (`OptOutCC1FFOption`).
For clarity, `OptInFFOption`/`OptOutFFOption` are renamed as
`OptInCC1FFOption`/`OptOutCC1FFOption`, respectively. Otherwise, this is
an NFC from Clang's perspective.
Differential Revision: https://reviews.llvm.org/D105881
More information about the All-commits
mailing list