summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/apimagic/apimagic.h1
-rw-r--r--src/logic/amgc_unit_entities.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/include/apimagic/apimagic.h b/include/apimagic/apimagic.h
index 6762ab2..a93615f 100644
--- a/include/apimagic/apimagic.h
+++ b/include/apimagic/apimagic.h
@@ -113,6 +113,7 @@ struct amgc_entity {
const union entity_t * entity;
const char * altname;
int enumval;
+ int ptrdepth;
bool fmbstr;
bool futf16;
bool fset;
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;