Skip to content

Commit 2349e8d

Browse files
docugen: walk past private snake_case helpers so the doc lands on the public macro
DocuGen attached a doc-comment block to whichever symbol came right after it. The Phase 2 / R2 Str-overload work introduced a recurring shape where the public surface lives in a MISRA_OVERLOAD + _Generic macro stack that sits BELOW the snake_case implementation helpers: /// doc block T snake_zstr(...); T snake_str(...); #define PascalName(...) MISRA_OVERLOAD(PascalName, __VA_ARGS__) #define PascalName_1(...) _Generic(...) #define PascalName_2(...) _Generic(...) The previous logic landed the doc on snake_zstr (which is private and therefore dropped), then broke out of the search. Result: BitVecFromStr, IntFromStr, FloatFromStr, SocketAddrParse, KvConfigGet[*], HttpRequestParse, MachoCacheResolve, and ~45 other public macros never made it into the generated site. Fix: treat 'private' the same as 'plumbing' in the per-block walk -- skip the declaration and keep looking for a public symbol to attach to (numbered MISRA_OVERLOAD arms already did this). The natural blank-line boundary still terminates the search, so docs only attach to the directly-following public-API stack. Confirmed by running DocuGen on Include/Misra/Std/Container/BitVec: generated-doc-BitVecFromStr.md and generated-doc-BitVecTryFromStr.md now appear with the right description, parameters, and tags. Full-tree run produces 1141 docs vs. ~1090 before, with the formerly-missing overloaded APIs now indexed.
1 parent 79152fe commit 2349e8d

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

Scripts/DocuGen.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,25 @@ def extract_symbols_and_store_content(file_path: Path):
256256

257257
symbol_name, inferred_kind = symbol_info
258258
internal_reason = internal_documentation_symbol_reason(symbol_name)
259-
if internal_reason == "private":
260-
line_index = definition_index + declaration_line_count
261-
break
262-
if internal_reason == "plumbing":
259+
# Walk past both `private` (snake_case impl helpers) and
260+
# `plumbing` (numbered MISRA_OVERLOAD arms, `_HAS_ARGS`,
261+
# etc.) until either a public PascalCase symbol absorbs
262+
# the doc block or the run of non-blank declarations
263+
# ends. The Phase-2 / R2 pattern is:
264+
#
265+
# /// doc block
266+
# T snake_zstr(...);
267+
# T snake_str(...);
268+
# #define PascalName(...) MISRA_OVERLOAD(PascalName, ...)
269+
# #define PascalName_1(...) _Generic(...)
270+
# #define PascalName_2(...) _Generic(...)
271+
#
272+
# where the public surface is `PascalName` and the doc
273+
# is meant for it; the snake_case decls are skipped and
274+
# the numbered overloads are plumbing. Treating private
275+
# the same as plumbing lets the doc walk past both to
276+
# land on PascalName.
277+
if internal_reason in ("private", "plumbing"):
263278
definition_index += declaration_line_count
264279
continue
265280

0 commit comments

Comments
 (0)