Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Created Nov 27, 2021
Embed
What would you like to do?
sub fix-struct-name {# CASTXML does not give a name to struct defined like typedef struct {} name
say "fix stuff";
for %structs.keys -> $id {
next if %structs{$id} !~~ Struct;
say %structs{$id};
if %structs{$id}.name eq $PLACEHOLDER {
for @typedefs -> $td {
if $td.ref-id eq $id {
say "merging struct ", $id , " with typedef ", $td.id;
%structs{$id}.name = $td.name;
%structs{$id}.id = $td.id;
%types{$id}.id = $td.id;
%types{$id}.name = $td.name;
%types{$td.id} = %types{$id};
%types{$id}:delete;
%structs{$td.id} = %structs{$id};
%structs{$id}:delete;
@typedefs.splice(@typedefs.first($td, :k), 1);
last;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment