- const symbol_t *sym = ent->symbol;
- if (sym != NULL) {
- const char *name = sym->string;
- obstack_printf(&obst, "%zu%s", strlen(name), name);
- } else {
- /* TODO need the first typedef name here */
- panic("mangling of unnamed class/enum types not implemented yet");
+ obstack_printf(&obst, "%u%s", (unsigned)strlen(name), name);
+}
+
+static void mangle_class_type(const compound_type_t *type)
+{
+ const symbol_t *sym = type->compound->base.symbol;
+ if (sym == NULL) {
+ if (type->compound->alias == NULL)
+ panic("mangling anonymous type");
+ sym = type->compound->alias->base.symbol;
+ }
+ print_name(sym->string);
+}
+
+static void mangle_enum_type(const enum_type_t *type)
+{
+ const symbol_t *sym = type->enume->base.symbol;
+ if (sym == NULL) {
+ if (type->enume->alias == NULL)
+ panic("mangling anonymous type");
+ sym = type->enume->alias->base.symbol;