+ if (finder != NULL
+ && (ret_comp->type == DEMANGLE_COMPONENT_NAME
+ || ret_comp->type == DEMANGLE_COMPONENT_QUAL_NAME
+ || ret_comp->type == DEMANGLE_COMPONENT_TEMPLATE
+ || ret_comp->type == DEMANGLE_COMPONENT_BUILTIN_TYPE))
+ {
+ char *local_name = cp_comp_to_string (ret_comp, 10);
+
+ if (local_name != NULL)
+ {
+ struct symbol *sym;
+ volatile struct gdb_exception except;
+
+ sym = NULL;
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0);
+ }
+ xfree (local_name);
+
+ if (except.reason >= 0 && sym != NULL)
+ {
+ struct type *otype = SYMBOL_TYPE (sym);
+ const char *new_name = (*finder) (otype, data);
+
+ if (new_name != NULL)
+ {
+ ret_comp->type = DEMANGLE_COMPONENT_NAME;
+ ret_comp->u.s_name.s = new_name;
+ ret_comp->u.s_name.len = strlen (new_name);
+ return;
+ }
+ }
+ }
+ }
+