diff options
author | midipix <writeonce@midipix.org> | 2016-01-07 06:22:00 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-01-07 06:22:00 -0500 |
commit | 3aebba9b602c353f6d9fe053d698d23d3589ee99 (patch) | |
tree | c3c2ac37149e0d834d389de999fbe11d55c3608d /src/logic | |
parent | 047bc5b40b4743e0b4c08507c68476b17c5aa016 (diff) | |
download | apimagic-3aebba9b602c353f6d9fe053d698d23d3589ee99.tar.bz2 apimagic-3aebba9b602c353f6d9fe053d698d23d3589ee99.tar.xz |
struct amgc_entity: add ptrdepth and its initialization bits.
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/amgc_unit_entities.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 <cparser/ast/ast_t.h> #include <cparser/ast/entity_t.h> +#include <cparser/ast/type_t.h> #include <libfirm/tv.h> #include <apimagic/apimagic.h> @@ -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; |