feat: support macros#1192
Open
gennaroprota wants to merge 1 commit intocppalliance:developfrom
Open
Conversation
✨ Highlights
🧾 Changes by Scope
🔝 Top Files
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1192 +/- ##
===========================================
+ Coverage 79.19% 81.89% +2.70%
===========================================
Files 308 33 -275
Lines 32332 2983 -29349
Branches 6493 691 -5802
===========================================
- Hits 25606 2443 -23163
+ Misses 4355 373 -3982
+ Partials 2371 167 -2204
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
An automated preview of the documentation is available at https://1192.mrdocs.prtest2.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-05-01 15:34:07 UTC |
3016b66 to
2c90a7c
Compare
This adds support for preprocessing macros: `#define` directives are
captured via a `clang::PPCallbacks` subclass and exposed as
`MacroSymbol` instances at the corpus root (macros aren't in any C++
scope, so they sit alongside the global namespace rather than under it).
Doc-comment association: Clang doesn't link comments to macros, so we
look up a preceding doc-comment by source location. A comment is
attached only when the lines between it and the directive are blank.
Filters apply to macros, too:
- `extract-all`: when off, undocumented macros are dropped.
- `exclude-symbols`, `include-symbols`, `implementation-defined`,
`see-below`: matched against the macro name.
- File-pattern filters: matched against the directive's source location.
Schema additions: `<macro>` is a new top-level element in mrdocs.rnc,
sibling of `<namespace>`, with `<source>` carrying the verbatim
definition (modulo a minor normalization).
New output pages: multipage mode now produces `macros.{ext}` at the
output root, listing every macro with a link to its per-symbol page. The
global-namespace page gains a "See also: Macros" navigation hint at the
bottom (multipage-only) so the new page is discoverable.
Macro `@param` blocks are validated.
Golden tests also cover the three filter paths (`extract-all: false`,
`include-symbols`, `exclude-symbols`).
Closes issue cppalliance#1127.
2c90a7c to
c1ce891
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for preprocessing macros:
#definedirectives are captured via aclang::PPCallbackssubclass and exposed asMacroSymbolinstances at the corpus root (macros aren't in any C++ scope, so they sit alongside the global namespace rather than under it).Doc-comment association: Clang doesn't link comments to macros, so we look up a preceding doc-comment by source location. A comment is attached only when the lines between it and the directive are blank.
Filters apply to macros, too:
extract-all: when off, undocumented macros are dropped.exclude-symbols,include-symbols,implementation-defined,see-below: matched against the macro name.Schema additions:
<macro>is a new top-level element in mrdocs.rnc, sibling of<namespace>, with<source>carrying the verbatim definition (modulo a minor normalization).New output pages: multipage mode now produces
macros.{ext}at the output root, listing every macro with a link to its per-symbol page. The global-namespace page gains a "See also: Macros" navigation hint at the bottom (multipage-only) so the new page is discoverable.Macro
@paramblocks are validated.Golden tests also cover the three filter paths (
extract-all: false,include-symbols,exclude-symbols).Closes issue #1127.