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

Allow -x c++ to work #432

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/generator/top_level.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLTypedefDecl
return nodes
end

function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLTypeAliasDecl, options)
# lhs_type = getTypedefDeclUnderlyingType(cursor)

# @show lhs_type
# if has_elaborated_reference(lhs_type)
# ty = TypedefElaborated()
# elseif has_function_reference(lhs_type)
ty = TypedefFunction()
# else
# ty = TypedefDefault()
# end

id = Symbol(spelling(cursor))

push!(nodes, ExprNode(id, ty, cursor, Expr[], Int[]))

return nodes
end

function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLMacroDefinition, options)
is_macro_no_op(cursor) && return nodes

Expand Down Expand Up @@ -162,7 +181,12 @@ collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLInclusionDirective,
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLLastPreprocessing, options) = nodes # FIXME: fix cltype.jl

# skip unexposed decl
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLUnexposedDecl, options) = nodes
function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLUnexposedDecl, options)
for child in children(cursor)
collect_top_level_nodes!(nodes, child, options)
end
nodes
end
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLFirstDecl, options) = nodes # FIXME: fix cltype.jl

# skip C11's `_Static_assert`
Expand Down