[Lldb-commits] [lldb] [lldb][docs] Generate the Python API enums page from headers (PR #202780)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 10 10:53:48 PDT 2026


================
@@ -0,0 +1,311 @@
+"""Generate the "Python API enumerators and constants" documentation page.
+
+LLDB exposes the enumerators from `lldb-enumerations.h` and the constants from
+`lldb-defines.h` as attributes of the `lldb` Python module. This script parses
+those two headers and emits a Markdown page documenting every public value, so
+the page can no longer drift out of sync with the source the way a
+hand-maintained copy does.
+
+The page is generated at build time and pulled into `python_api_enums.md` via
+the `{build-include}` directive (see `lldb/docs/_ext/build_include.py`).
+"""
+
+import argparse
+import re
+from collections.abc import Iterator
+from dataclasses import dataclass, field
+
+# Matches the start of an enum declaration up to and including the opening
+# brace, capturing the enum name. Covers plain `enum Name {`, scoped
+# `enum Name : type {`, and the `FLAGS_ENUM(Name){` / `FLAGS_ANONYMOUS_ENUM()`
+# macros from lldb-enumerations.h. Enum bodies never contain nested braces, so
+# the matching `}` is simply the next one in the text.
----------------
kastiglione wrote:

couldn't a comment contain a `}`?

https://github.com/llvm/llvm-project/pull/202780


More information about the lldb-commits mailing list