self-referential c record imports
This commit is contained in:
@@ -415,6 +415,11 @@ populate_record :: proc(ctx: ^Context, index: u32, declaration: CXCursor) {
|
||||
ctx.result.records[index].kind = .Union if ctx.api.get_cursor_kind(definition) == CXCursor_UnionDecl else .Struct
|
||||
ctx.result.records[index].size = u64(size)
|
||||
ctx.result.records[index].alignment = u32(alignment)
|
||||
// Mark in-progress before visiting fields: a self-referential field (e.g. the
|
||||
// `struct __sFILE *` inside FILE) re-enters populate_record for this same record;
|
||||
// the top guard now short-circuits instead of recursing forever. The final line
|
||||
// recomputes the real value from `reason`.
|
||||
ctx.result.records[index].complete = true
|
||||
field_ctx := Record_Field_Context{ctx=ctx, record=index}
|
||||
_ = ctx.api.visit_children(definition, visit_record_field, &field_ctx)
|
||||
ctx.result.records[index].complete = len(ctx.result.records[index].reason) == 0
|
||||
|
||||
Reference in New Issue
Block a user