- if (entity->kind == ENTITY_FUNCTION && entity->declaration.type->function.linkage == LINKAGE_INVALID)
- panic("linkage type of function is invalid");
+ if (entity->kind == ENTITY_FUNCTION) {
+ type_t *type = skip_typeref(entity->declaration.type);
+ assert(is_type_function(type));
+
+ switch (type->function.linkage) {
+ case LINKAGE_INVALID:
+ panic("linkage type of function is invalid");
+
+ default:
+ if (entity->function.actual_name != NULL)
+ return new_id_from_str(entity->function.actual_name->string);
+ break;
+ }
+ }