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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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 2 times, most recently from bfb5167 to f8a30c0 Compare December 10, 2024 14:15
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.

1 participant