Skip to content

Commit 6be7d28

Browse files
committed
Allow -x c++ to work
1 parent 9668437 commit 6be7d28

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/generator/top_level.jl

+25-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLTypedefDecl
4949
return nodes
5050
end
5151

52+
function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLTypeAliasDecl, options)
53+
# lhs_type = getTypedefDeclUnderlyingType(cursor)
54+
55+
# @show lhs_type
56+
# if has_elaborated_reference(lhs_type)
57+
# ty = TypedefElaborated()
58+
# elseif has_function_reference(lhs_type)
59+
ty = TypedefFunction()
60+
# else
61+
# ty = TypedefDefault()
62+
# end
63+
64+
id = Symbol(spelling(cursor))
65+
66+
push!(nodes, ExprNode(id, ty, cursor, Expr[], Int[]))
67+
68+
return nodes
69+
end
70+
5271
function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLMacroDefinition, options)
5372
is_macro_no_op(cursor) && return nodes
5473

@@ -159,7 +178,12 @@ collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLInclusionDirective,
159178
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLLastPreprocessing, options) = nodes # FIXME: fix cltype.jl
160179

161180
# skip unexposed decl
162-
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLUnexposedDecl, options) = nodes
181+
function collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLUnexposedDecl, options)
182+
for child in children(cursor)
183+
collect_top_level_nodes!(nodes, child, options)
184+
end
185+
nodes
186+
end
163187
collect_top_level_nodes!(nodes::Vector{ExprNode}, cursor::CLFirstDecl, options) = nodes # FIXME: fix cltype.jl
164188

165189
# skip C11's `_Static_assert`

0 commit comments

Comments
 (0)