aboutsummaryrefslogtreecommitdiff
path: root/lld/MinGW/Driver.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2023-08-14 14:07:04 -0700
committerJustin Bogner <mail@justinbogner.com>2023-08-15 01:16:58 -0700
commitdcb6d212fdfb1db60bc5ba1c877897cb5ba0546c (patch)
treee18b2046f666646b4521a1991f6525e7f489e677 /lld/MinGW/Driver.cpp
parentd60c3d08e78dfbb4b180776b83e910d810e1f36a (diff)
downloadllvm-dcb6d212fdfb1db60bc5ba1c877897cb5ba0546c.zip
llvm-dcb6d212fdfb1db60bc5ba1c877897cb5ba0546c.tar.gz
llvm-dcb6d212fdfb1db60bc5ba1c877897cb5ba0546c.tar.bz2
Reapply "[Option] Add "Visibility" field and clone the OptTable APIs to use it"
This reverts commit 4e3b89483a6922d3f48670bb1c50a37f342918c6, with fixes for places I'd missed updating in lld and lldb. I've also renamed OptionVisibility::Default to "DefaultVis" to avoid ambiguity since the undecorated name has to be available anywhere Options.inc is included. Original message follows: This splits OptTable's "Flags" field into "Flags" and "Visibility", updates the places where we instantiate Option tables, and adds variants of the OptTable APIs that use Visibility mask instead of Include/Exclude flags. We need to do this to clean up a bunch of complexity in the clang driver's option handling - there's a whole slew of flags like CoreOption, NoDriverOption, and FlangOnlyOption there today to try to handle all of the permutations of flags that the various drivers need, but it really doesn't scale well, as can be seen by things like the somewhat recently introduced CLDXCOption. Instead, we'll provide an additive model for visibility that's separate from the other flags. For things like "HelpHidden", which is used as a "subtractive" modifier for option visibility, we leave that in "Flags" and handle it as a special case. Note that we don't actually update the users of the Include/Exclude APIs here or change the flags that exist in clang at all - that will come in a follow up that refactors clang's Options.td to use the increased flexibility this change allows. Differential Revision: https://reviews.llvm.org/D157149
Diffstat (limited to 'lld/MinGW/Driver.cpp')
-rw-r--r--lld/MinGW/Driver.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 67c4505..3a6d52f 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -51,6 +51,7 @@
#endif
using namespace lld;
+using namespace llvm::opt;
using namespace llvm;
// Create OptTable
@@ -71,9 +72,13 @@ enum {
// Create table mapping all options defined in Options.td
static constexpr opt::OptTable::Info infoTable[] = {
-#define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X7, X8, X9, X10, X11, X12) \
- {X1, X2, X10, X11, OPT_##ID, opt::Option::KIND##Class, \
- X9, X8, OPT_##GROUP, OPT_##ALIAS, X7, X12},
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, \
+ VISIBILITY, PARAM, HELPTEXT, METAVAR, VALUES) \
+ {PREFIX, NAME, HELPTEXT, \
+ METAVAR, OPT_##ID, opt::Option::KIND##Class, \
+ PARAM, FLAGS, VISIBILITY, \
+ OPT_##GROUP, OPT_##ALIAS, ALIASARGS, \
+ VALUES},
#include "Options.inc"
#undef OPTION
};