Skip to content

Commit

Permalink
Allow -x c++ to work
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed May 16, 2023
1 parent 9668437 commit 6be7d28
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/generator/top_level.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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 @@ -159,7 +178,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

0 comments on commit 6be7d28

Please sign in to comment.