Skip to content

transpile: support anonymous struct/union/enums within structs and unions#1361

Merged
kkysen merged 2 commits intoimmunant:masterfrom
bungcip:anon-enum
Sep 28, 2025
Merged

transpile: support anonymous struct/union/enums within structs and unions#1361
kkysen merged 2 commits intoimmunant:masterfrom
bungcip:anon-enum

Conversation

@bungcip
Copy link
Copy Markdown
Contributor

@bungcip bungcip commented Sep 5, 2025

RecordDecl can have anonymous struct or enum as children so we must collect them so they can have parent in TypedAstContext.

@bungcip bungcip marked this pull request as ready for review September 5, 2025 18:14
@kkysen kkysen self-requested a review September 8, 2025 22:56
Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, too! I left some comments/suggestions about naming and other stuff, but the logic LGTM.

@kkysen kkysen changed the title collect FieldDecl, EnumDecl, and RecordDecl as children of TagStructDecl/TagUnionDecl node transpile: support anonymous record types (struct/union/enum) within other record types Sep 12, 2025
@kkysen kkysen changed the title transpile: support anonymous record types (struct/union/enum) within other record types transpile: support anonymous struct/union/enum within structs and unions Sep 12, 2025
@kkysen kkysen changed the title transpile: support anonymous struct/union/enum within structs and unions transpile: support anonymous struct/union/enums within structs and unions Sep 12, 2025
@bungcip bungcip force-pushed the anon-enum branch 2 times, most recently from 8bd2164 to 4f4c86f Compare September 27, 2025 21:29
… TagStructDecl/TagUnionDecl node

RecordDecl can have anonymous struct or enum as children so we must collect them so they can have parent in TypedAstContext
@bungcip
Copy link
Copy Markdown
Contributor Author

bungcip commented Sep 28, 2025

hi @kkysen, sorry for late response. can you review this PR again?

@kkysen kkysen self-requested a review September 28, 2025 06:24
Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! All LGTM now.

@kkysen kkysen merged commit e830065 into immunant:master Sep 28, 2025
5 checks passed
kkysen added a commit that referenced this pull request Sep 29, 2025
 merged

GitHub annoyingly does not re-run CI based on the result of
merging a PR into `master`, just that PR itself.
kkysen added a commit that referenced this pull request Sep 29, 2025
 merged (#1383)

GitHub annoyingly does not re-run CI based on the result of merging a PR
into `master`, just that PR itself.
@bungcip bungcip deleted the anon-enum branch October 5, 2025 05:54
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.

C2Rust Crashes on Anonymous Enum Without Field in Anonymous Union Inside Struct

2 participants