Re: D language support

Mihail Zenkov
2010-04-22T00:11:01Z

> > +static const char *mangled_str;
>
> I think this part needs to be rethinked, or at least I don't understand
> why this needs to be a global. Can you elaborate?
>
> Similarly, I do not understand why ...
> > +/* Temporary obstack used for holding strings. */
> > +static struct obstack tempbuf;
> ... needs to be a global?

It not real global. As it static it visibility limited to current file. In this case we can
think about this file as if it was C++ class. IMHO it more easy readable code - we
promptly see all function use same variables.

I see same code in many other places (c-exp.c:3823, c-exp.c:4192, c-exp.c:4609,
ada-lang.c:307, ada-exp.c:2769 and others).

> > + if (gsymbol->language == language_d
> > + || gsymbol->language == language_auto)
> > + {
> > + demangled =
> > + d_demangle(mangled, 0);
>
> Can you join the last two lines?

Current code:

if (gsymbol->language == language_objc
|| gsymbol->language == language_auto)
{
demangled =
objc_demangle (mangled, 0);
if (demangled != NULL)
{
gsymbol->language = language_objc;
return demangled;
}
}
if (gsymbol->language == language_cplus
|| gsymbol->language == language_auto)
{
demangled =
cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
if (demangled != NULL)
{
gsymbol->language = language_cplus;
return demangled;
}
}
if (gsymbol->language == language_java)
{
demangled =
cplus_demangle (mangled,
DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);

Still i should join it?