Skip to content

fix: document only a file's own declarations, parsed with all its preprocessor options - #1

Merged
ubmarco merged 2 commits into
mainfrom
fix/docs-main-file-only
Oct 1, 2026
Merged

ubmarco merged 2 commits into
mainfrom
fix/docs-main-file-only

Conversation

@ubmarco

@ubmarco ubmarco commented Oct 1, 2026

Copy link
Copy Markdown
Member

The same two fixes as the upstream PR cuinixam#9, on the useblocks fork, which SPLed pins until upstream releases them.

  • fix(docs) — clanguru docs documents only the declarations of the source file itself, not those of the headers it includes (libstdc++'s __gthread_* functions in every GoogleTest listing).
  • fix(compilation) — every preprocessor option of the compile command is kept (-isystem, -iquote, -idirafter, -include, -imacros, -U besides -I/-D), so #ifdef branches follow the build's configuration headers.

Tests for both; pypeline run passes (139 passed, 4 skipped). Details and the SPLed case are in cuinixam#9.

`clanguru docs` documented every function definition and class of the
translation unit, including those of the headers it includes. For a
GoogleTest file this lists libstdc++'s `__gthread_*` functions from
gthr-default.h and gtest's `RUN_ALL_TESTS`, with those headers' line
numbers, under the title of the test file. Wherever libclang finds the
system headers, test_doc_structure_for_gtest_files failed on main for the
same reason.

The parser keeps every declaration, because the mock generator needs the
headers' ones; the documentation now takes only those located in the
source file.
Only -I and -D were taken from the compilation database. A directory
passed as -isystem (CMake does so for SYSTEM includes, and for the
generated configuration headers of some build systems) was dropped, as
were -iquote, -idirafter, -include, -imacros and -U. libclang then parsed
the file without those headers, and every `#ifdef` on a macro they define
took the wrong branch: the documentation showed the code of a
configuration the file is not built in.
@ubmarco
ubmarco marked this pull request as ready for review October 1, 2026 14:10
@ubmarco
ubmarco merged commit 50a25d7 into main Oct 1, 2026
ubmarco added a commit to useblocks/SPLed that referenced this pull request Oct 1, 2026
…branches

spl-core ce62088 is the merge of useblocks/spl-core#5 into the fork's
develop, which mirrors avengineers' develop; clanguru 50a25d7 the merge of
useblocks/clanguru#1 into the fork's main. Both contain the commits pinned
before (5b98203, 07b8843), which were reachable only from feature branches
and pull-request refs. Answers finding 1 of the review of #4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant