This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA]: Make class_name_from_physname part of language vector


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:

> +/* 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.

> +
> +  /* 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).


-- 
Daniel Jacobowitz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]