Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly skip EnumForwardDecls even with attributes #522

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

christiangnrd
Copy link
Contributor

@christiangnrd christiangnrd commented Dec 9, 2024

MacOS ObjectiveC headers have enum forward declarations with attributes.

Currently, such a node gets marked as skip during CodegenPreprocessing:

if skip_check(dag, node)
skip_mode = is_dup_tagtype(node) ? SoftSkip() : Skip()
skip_mode == Skip() && push!(x.skip_nodes, i)
dag.nodes[i] = ExprNode(node.id, skip_mode, node.cursor, node.exprs, node.adj)
show_info &&
@info "[CodegenPreprocessing]: skip a $(node.type) node named $(node.id)"
end

but then it immediately gets replaced with an EnumLayout due to the next check checking the original node:

if attribute_check(dag, node)
ty = attribute_type(node.type)
dag.nodes[i] = ExprNode(node.id, ty, node.cursor, node.exprs, node.adj)
show_info &&
@info "[CodegenPreprocessing]: mark an attribute $(node.type) node named $(node.id)"
end

I'm not sure if my fix is the intended behaviour, so it would be nice to have someone review it. Other solutions I consedered were adding a continue to the end of each check (or only to skip_check), or maybe instead of doing checks on the original node, always check the newest.

Includes changes from #519.

@christiangnrd christiangnrd changed the title Enumattributes Properly skip EnumForwardDecls even with attributes Dec 9, 2024
@christiangnrd christiangnrd changed the title Properly skip EnumForwardDecls even with attributes Properly skip EnumForwardDecls even with attributes Dec 9, 2024
@christiangnrd christiangnrd force-pushed the enumattributes branch 3 times, most recently from f8a30c0 to 0a50427 Compare December 12, 2024 15:42
@Gnimuc Gnimuc merged commit 76f5d57 into JuliaInterop:master Jan 18, 2025
11 checks passed
@christiangnrd christiangnrd deleted the enumattributes branch January 18, 2025 15:17
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.

2 participants