windows-rdl more complete GUID parsing#4603
Open
kennykerr wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
✅ Ready to approve
The change is well-scoped, preserves prior behavior via a fallback path, and adds a targeted regression fixture for the reported macroized GUID parsing failure.
Note: this review does not count toward required approvals for merging.
Pull request overview
Improves windows-rdl’s clang-based extraction of IID_ GUIDs by handling macroized GUID initializers (e.g., the 7zip SDK pattern) via AST constant evaluation, and adds a dedicated fixture to prevent regressions.
Changes:
- Parse
IID_GUID variable initializers via libclang AST evaluation (clang_Cursor_Evaluate) with a token-based fallback. - Add
Cursor::evaluate_unsigned()helper to safely evaluate integer constant expressions. - Add a new clang fixture (
iid_var_macroized) covering macro-expanded GUID initializers and expected RDL output.
File summaries
| File | Description |
|---|---|
| crates/libs/rdl/src/clang/mod.rs | Adds AST-based GUID initializer parsing for IID_ variables with fallback to the existing token-based parser. |
| crates/libs/rdl/src/clang/cx.rs | Introduces Cursor::evaluate_unsigned() to read evaluated integer constants from libclang. |
| crates/tests/libs/bindgen/data/clang/iid_var_macroized/input.h | New fixture input modeling macroized GUID variable declarations (7zip-style). |
| crates/tests/libs/bindgen/data/clang/iid_var_macroized/expected.rdl | New golden output validating correct GUID extraction from macroized initializers. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 0
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
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.
Fixes: #4584