Daniel Jacobowitz wrote: > On Mon, Jul 05, 2004 at 04:21:20PM -0400, Jeff Johnston wrote: > >>>You've left in a lot of hokery from the C++ support which I'm >>>reasonably confident Java does not need. I don't believe that Java >>>mangled names will ever have templates, or classes nested inside of >>>functions, or multiple argument lists - no depth at all. Also, I'd >>>appreciate it if you called it something other than >>>find_last_component; the C++ version shouldn't have such a generic name >>>either, IMO. >>> >>>Otherwise this looks fine. > > >>I have made the changes you recommended. The function now only looks for >>the opening parenthesis. I renamed it to "find_member_function_name" as >>well. > > > Sorry I wasn't clear - I was hoping for something that said it was for > Java. Maybe java_find_last_component? Also: > Oops. I thought you meant the functional description was too generic. Anyway, changed to java_find_last_component. > >>+/* Find the member function name of the demangled name NAME. NAME >>+ must be a method name including arguments, in order to correctly >>+ locate the last component. >>+ >>+ This function return a pointer to the first dot before the >>+ member function name, or NULL if the name was not of the >>+ expected form. */ >>+ >>+static const char * >>+find_member_function_name (const char *name) >>+{ >>+ const char *p; >>+ int depth; > > > DEPTH is now write-only. > Deleted. > >>+ >>+ /* Functions can have local classes, so we need to find the >>+ beginning of the last argument list, not the end of the first >>+ one. */ >>+ p = name + strlen (name) - 1; >>+ while (p > name && *p != ')') >>+ p--; > > > Is this true for Java? > > I don't think it is. If it isn't, you can just search forward for the > first '(' (and use strchr, even - I'm not sure why the old code doesn't > use strrchr). > No, you're correct. I have simplified the code. New ChangeLog with name change: 2004-07-05 Jeff Johnston * language.h (struct_language_defn): Add new function pointer: la_class_name_from_physname. Also add new prototype for language_class_name_from_physname. * language.c (language_class_name_from_physname): New function. (unk_lang_class_name): Ditto. (unknown_language_defn, auto_language_defn): Change to add unk_lang_class_name function pointer for la_class_name_from_physname. (local_language_defn): Ditto. * dwarf2read.c (guess_structure_name): Change to call language_class_name_from_physname. (determine_class_name): Ditto. * cp-support.c (class_name_from_physname): Renamed. (cp_class_name_from_physname): New name of function. * cp-support.h: Ditto. * c-lang.c (c_language_defn): Change to add NULL for class_name_from_physname function pointer. (cplus_language_defn): Change to add cp_class_name_from_physname. * jv-lang.c (java_class_name_physname): New function. (java_find_last_component): New static routine. (java_language_defn): Add java_class_name_from_physname pointer. * ada-lang.c (ada_language_defn): Change to add NULL for class_name_from_physname function pointer. * f-lang.c (f_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * scm-lang.c (scm_language_defn): Ditto. -- Jeff J. >