+static void print_name(const char* name)
+{
+ 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;
+ }
+ print_name(sym->string);
+}
+
+static void mangle_array_type(const array_type_t *type)
+{
+ if (type->is_vla) {
+ obstack_1grow(&obst, 'A');
+ obstack_1grow(&obst, '_');
+ } else if (type->size_constant) {
+ obstack_printf(&obst, "A%u_", (unsigned) type->size);
+ } else {
+ panic("mangling of non-constant sized array types not implemented yet");
+ }
+ mangle_type(type->element_type);
+}
+
+static void mangle_complex_type(const complex_type_t *type)
+{
+ obstack_1grow(&obst, 'C');
+ obstack_1grow(&obst, get_atomic_type_mangle(type->akind));
+}
+
+static void mangle_imaginary_type(const imaginary_type_t *type)
+{
+ obstack_1grow(&obst, 'G');
+ obstack_1grow(&obst, get_atomic_type_mangle(type->akind));
+}
+