+
+#define CLEANUP_AND_RETURN_ERROR(ret) do { \
+ if (member_type != NULL && newly_allocated_member_type) { \
+ type_destroy(member_type); \
+ free(member_type); \
+ } \
+ if (result != NULL) { \
+ type_destroy(result); \
+ free(result); \
+ } \
+ dict_erase (type_dieoffset_hash, &die_offset, \
+ NULL, NULL, NULL); \
+ dict_insert(type_dieoffset_hash, &die_offset, \
+ &(struct arg_type_info*){ \
+ type_get_simple(ARGTYPE_VOID)}); \
+ return ret; \
+ } while (0)
+
+
+ struct arg_type_info *result = NULL;
+ struct arg_type_info *member_type = NULL;
+ int newly_allocated_member_type = 0;
+
+ Dwarf_Off die_offset = dwarf_dieoffset(parent);
+
+ result = calloc(1, sizeof(struct arg_type_info));
+ if (result == NULL) {
+ complain(parent, "alloc error");
+ CLEANUP_AND_RETURN_ERROR(NULL);
+ }
+ type_init_struct(result);
+ if (dict_insert(type_dieoffset_hash, &die_offset, &result) != 0) {
+ complain(parent, "Couldn't insert into cache dict");
+ CLEANUP_AND_RETURN_ERROR(NULL);
+ }