[all-commits] [llvm/llvm-project] e49c15: [lldb] Dynamically generate enum names in lldbutil

Dave Lee via All-commits all-commits at lists.llvm.org
Sun Aug 7 11:16:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e49c1568b6160f9a02da3295ac0d5c684fb64201
      https://github.com/llvm/llvm-project/commit/e49c1568b6160f9a02da3295ac0d5c684fb64201
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2022-08-07 (Sun, 07 Aug 2022)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbutil.py

  Log Message:
  -----------
  [lldb] Dynamically generate enum names in lldbutil

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"

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




More information about the All-commits mailing list