HomePhabricator

[lldb] Let table gen create command option initializers.

Authored by teemperor on Jul 12 2019, 8:30 AM.

Description

[lldb] Let table gen create command option initializers.

Summary:
We currently have man large arrays containing initializers for our command options.
These tables are tricky maintain as we don't have any good place to check them for consistency and
it's also hard to read (nullptr, {}, 0 is not very descriptive).

This patch fixes this by letting table gen generate those tables. This way we can have a more readable
syntax for this (especially for all the default arguments) and we can let TableCheck check them
for consistency (e.g. an option with an optional argument can't have eArgTypeNone, naming of flags', etc.).

Also refactoring the related data structures can now be done without changing the hundred of option initializers.

For example, this line:

{LLDB_OPT_SET_ALL, false, "hide-aliases",         'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the command list."},

becomes this:

def hide_aliases : Option<"hide-aliases", "a">, Desc<"Hide aliases in the command list.">;

For now I just moved a few initializers to the new format to demonstrate the change. I'll slowly migrate the other
option initializers tables in separate patches.

Reviewers: JDevlieghere, davide, sgraenitz

Reviewed By: JDevlieghere

Subscribers: jingham, xiaobai, labath, mgorny, abidh, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64365

llvm-svn: 365908

Details

Committed
teemperorJul 12 2019, 8:30 AM
Reviewer
JDevlieghere
Differential Revision
D64365: [lldb] Let table gen create command option initializers.
Parents
rG38cd364007a9: [LegacyPassManager] Small ModuleCount cleanup
Branches
Unknown
Tags
Unknown