From 3aebba9b602c353f6d9fe053d698d23d3589ee99 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 7 Jan 2016 06:22:00 -0500 Subject: struct amgc_entity: add ptrdepth and its initialization bits. --- src/logic/amgc_unit_entities.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/logic/amgc_unit_entities.c b/src/logic/amgc_unit_entities.c index e5b9000..4309d89 100644 --- a/src/logic/amgc_unit_entities.c +++ b/src/logic/amgc_unit_entities.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -40,10 +41,12 @@ int amgc_get_unit_entities( struct amgc_entity * aentity; struct amgc_unit_entities * uentities; union entity_t * entity; + union type_t * etype; struct amgc_unit_entities_impl *entities; size_t ndefs; size_t nelements; int enumval; + int ptrdepth; if (!meta) meta = &umeta; @@ -125,7 +128,14 @@ int amgc_get_unit_entities( break; case ENTITY_TYPEDEF: + etype = entity->declaration.type; + ptrdepth = 0; + + for (; etype->kind == TYPE_POINTER; etype=etype->pointer.points_to) + ptrdepth++; + uentities->typedefs[meta->ntypedefs].entity = entity; + uentities->typedefs[meta->ntypedefs].ptrdepth = ptrdepth; meta->ntypedefs++; break; -- cgit v1.2.3