X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcontext_dump.c;h=b778525c93a4f4aa76bf9df59a2240933da73036;hp=c62ebf23b4bd5e7d1b2b2d427eccec729a0fceca;hb=d3171526ab7658114cac4ebe1098af4b038e576e;hpb=ed5ebb3caac1ac8bf6a4b32eabfb523f23de8576 diff --git a/src/context_dump.c b/src/context_dump.c index c62ebf2..b778525 100644 --- a/src/context_dump.c +++ b/src/context_dump.c @@ -167,7 +167,7 @@ static inline void dump_typedefs(int fd, decl_typedefs *defs) { static inline void dump_struct(int fd, decl_struct *strct) { size_t j; - dprintf(fd, "struct %s::(%zu)", strct->name, strct->size); + dprintf(fd, "struct %s::(%zu, %zu)", strct->name, strct->align, strct->size); if (strct->args && strct->args->count) { dprintf(fd, " {\n"); for (j = 0; j < strct->args->count; ++j) { @@ -189,12 +189,36 @@ static inline void dump_structs(int fd, decl_structs *structs) { for (i = 0; i < structs->count; ++i) { decl_struct *strct = structs->list[i]; - dump_struct(fd, strct); dprintf(fd, "\n"); } } +static inline void dump_union(int fd, decl_union *unn) { + size_t j; + + dprintf(fd, "union %s::(%zu, %zu) {\n", unn->name, unn->align, unn->size); + for (j = 0; j < unn->args->count; ++j) { + decl_arg *uarg = unn->args->args[j]; + + dprintf(fd, "\t"); + dump_decl_arg(fd, uarg); + dprintf(fd, "::(%zu, %zu);\n", uarg->layout->pos, uarg->layout->len); + } + dprintf(fd, "}"); +} + +static inline void dump_unions(int fd, decl_unions *unions) { + size_t i; + + for (i = 0; i < unions->count; ++i) { + decl_union *unn = unions->list[i]; + + dump_union(fd, unn); + dprintf(fd, "\n"); + } +} + static inline void dump_enum(int fd, decl_enum *e) { size_t j; @@ -440,7 +464,10 @@ void PSI_ContextDump(PSI_Context *C, int fd) dump_typedefs(fd, C->defs); dprintf(fd, "\n"); } - + if (C->unions) { + dump_unions(fd, C->unions); + dprintf(fd, "\n"); + } if (C->structs) { dump_structs(fd, C->structs); dprintf(fd, "\n");