[Lldb-commits] [PATCH] D64365: [lldb] Let table gen create command option initializers.

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 13:26:00 PDT 2019


teemperor created this revision.
teemperor added reviewers: JDevlieghere, davide, sgraenitz.
Herald added subscribers: lldb-commits, abidh, mgorny.
Herald added a project: LLDB.
teemperor marked an inline comment as done.
teemperor added inline comments.


================
Comment at: lldb/source/Commands/OptionsBase.td:11
+  // *.inc file.
+  string Command;
+}
----------------
I'm open to renaming this if anyone has a better name for this.


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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64365

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/source/Commands/BreakpointList.td
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectHelp.cpp
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Commands/Options.td
  lldb/source/Commands/OptionsBase.td
  lldb/utils/TableGen/CMakeLists.txt
  lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
  lldb/utils/TableGen/LLDBTableGen.cpp
  lldb/utils/TableGen/LLDBTableGenBackends.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64365.208487.patch
Type: text/x-patch
Size: 20429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190708/86336f26/attachment-0001.bin>


More information about the lldb-commits mailing list