[Lldb-commits] [PATCH] D131138: [lldb] Dynamically generate enum names in lldbutil

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 3 20:54:54 PDT 2022


kastiglione created this revision.
kastiglione added reviewers: mib, JDevlieghere.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Change the `<enum>_to_str` functions in lldbutil to be dynamic.

Instead of a manually maintained if/elif switch, the functions now perform
lookup in a dynamically generated dict. The names are determined by stripping
the enum's prefix, and then lowercasing the remaining suffix, ex:

  eStateRunning -> "running"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131138

Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131138.449862.patch
Type: text/x-patch
Size: 6213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220804/0654363b/attachment.bin>


More information about the lldb-commits mailing list