fix(parsing): recover export-macro-hidden type definitions (#1989) - #2005
fix(parsing): recover export-macro-hidden type definitions (#1989)#2005XIYBHK wants to merge 1 commit into
Conversation
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thanks for the clarification. I may be interpreting the timeline differently, so I checked the issue history. Before opening this PR, I asked whether to pursue the heuristic option 1 or the config-driven option 2, and whether to combine them. The reply on #1989 explicitly asked me to "open a focused PR for option 1 only" and specified the candidate cap, negative controls, no user-configured define plumbing, and the class/struct/enum/free-function test boundary: #1989 (comment) I used that as the scope for this PR. I agree that the exact regex was not approved character-for-character; the implementation made the candidate filter deliberately conservative and bounded. If the exact filter or any other part of the scope should change, I am happy to adjust it. I just wanted to clarify that the option-1 direction and scope were discussed in the issue before implementation. |
|
You are right, and thank you for correcting the record. The maintainer reply on #1989 did explicitly ask for a focused PR implementing option 1 with the bounded candidate scan and the stated negative controls. Our earlier comment here saying that the direction had never been agreed was wrong. I am sorry: you followed the scope we gave you. The option-1 direction therefore remains the approved scope. The exact candidate filter and implementation still receive normal review on their merits, but you do not need to re-litigate why this PR exists. Thank you for responding with the thread reference and keeping the correction factual. |
…1989) Collect a bounded set of conventional export macro candidates and inject empty definitions into the existing C/C++ preprocessing second pass without overriding explicit caller definitions. Conservatively reconcile remapped definitions to recover hidden classes, structs, enums, free functions, and inline methods while suppressing matching base-class phantom callables. Add focused regression coverage for supported suffixes, ordinary all-caps negative controls, candidate limits, comments, strings, raw strings, overlong names, explicit define priority, and C/C++ extraction. Local MinGW extraction tests pass (344/344). ASan/UBSan were not available in the local MinGW toolchain and remain covered by upstream CI. Signed-off-by: XIYBHK <xiybhk@163.com>
256b3d3 to
ec28e66
Compare
|
Rebased onto the latest main (2f9828d) and resolved the conflict in tests/test_extraction.c by preserving both the upstream extraction tests and the #1989 regression coverage. The PR remains a single commit and still changes only the four intended files. The rebased files pass single-file compilation and clang-format checks locally. The full sanitizer test runner cannot be linked in the local MinGW environment because its sanitizer runtime/spec file is unavailable; the refreshed CI matrix is running now. |

What does this PR do?
Fixes #1989
This PR implements the agreed option 1 for export-macro-hidden C/C++ definitions. It collects a bounded set of conventional export-macro candidates, injects empty
NAME=definitions into the existing preprocessing second pass, and preserves explicitly configured defines.The extraction reconciliation is deliberately conservative: remapped definitions must pass line mapping, original-line visibility, and qualified-name deduplication gates. It recovers hidden class/struct/enum definitions, free functions, and inline methods, while suppressing only base-class phantom callables and preserving ordinary all-caps identifiers.
Candidate scanning is bounded to 32 names per file and skips comments, strings, character literals, line-spliced comments, and C++ raw strings. No user-configured define plumbing, version changes, Makefile changes, or unrelated files are included.
Validation
git diff --cached --checkandgit-clang-format --diff --stagedis clean.Signed-off-bytrailer.cppcheckexecutable and three pre-existing clang-format violations outside this PR's four files.Known boundaries are unchanged: one-character export prefixes such as
X_APIare intentionally rejected, header-only prototypes without a definition remain governed by the existing extractor behavior, and UINTERFACE cascade handling is deferred to a follow-up issue.