From 3c7c2918f67e424c8e0d4909158f1c89d51725d4 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Thu, 27 Mar 2025 13:47:40 -0700 Subject: [PATCH] replace pointers to incomplete types in UDT members --- src/rdi_make/rdi_make_local.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/rdi_make/rdi_make_local.c b/src/rdi_make/rdi_make_local.c index 3de6d4af..302126fe 100644 --- a/src/rdi_make/rdi_make_local.c +++ b/src/rdi_make/rdi_make_local.c @@ -464,7 +464,7 @@ rdim_local_hash(RDIM_String8 string) } internal void -rdim_local_resolve_incomplete_types(RDIM_TypeChunkList *types) +rdim_local_resolve_incomplete_types(RDIM_TypeChunkList *types, RDIM_UDTChunkList *udts) { ProfBeginFunction(); @@ -603,6 +603,27 @@ rdim_local_resolve_incomplete_types(RDIM_TypeChunkList *types) } } } + for(RDIM_UDTChunkNode *chunk = udts->first; chunk != 0; chunk = chunk->next) + { + for(RDI_U64 i = 0; i < chunk->count; ++i) + { + RDIM_UDT *udt = &chunk->v[i]; + RDI_U64 self_idx = rdim_idx_from_type(udt->self_type); + if(fwd_map[self_idx]) + { + udt->self_type = fwd_map[self_idx]; + } + + for(RDIM_UDTMember *member = udt->first_member; member != 0; member = member->next) + { + RDI_U64 member_idx = rdim_idx_from_type(member->type); + if(fwd_map[member_idx]) + { + member->type = fwd_map[member_idx]; + } + } + } + } ProfEnd(); scratch_end(scratch); @@ -635,7 +656,7 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params) //////////////////////////////// // resolve incomplete types - rdim_local_resolve_incomplete_types(&in_params->types); + rdim_local_resolve_incomplete_types(&in_params->types, &in_params->udts); //////////////////////////////// // compute type indices