[GCC-XML] Not Forgetting Original Typedefs

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 29 12:24:28 EDT 2004


Hmm, with more investigation it seems things aren't very consistent.

typedef int foo;

void bar(foo);

class Klass
{
	void meth(foo);
}

The XML from the above defines the bar() argument as int and the meth() 
argument as foo.

This means it's less of a problem than I first thought it was - but it now 
looks more like a bug.

Phil

On Thursday 29 July 2004 3:33 pm, Brad King wrote:
> Phil Thompson wrote:
> > Hi,
> >
> > With something like the following...
> >
> > typedef int foo;
> > void bar(foo);
> >
> > ...the XML defines the bar argument as an int rather than a foo. For me,
> > this is a problem. I either need to define the argument in terms of the
> > original typedef - or have an additional attribute that links back to the
> > typedef.
> >
> > Is this possible? I'm quite happy to hack around the source if somebody
> > could point me in the right direction.
>
> I do not know if it is possible.  I think GCC's parser might throw away
> this information before GCC-XML's code ever sees it.  The place to look
> is in GCC/gcc/cp/xml.c in the function xml_output_function_decl.  Near
> the bottom of the function is a comment:
>
>    /* Print out the argument list for this function.  */
>
> Below that comment is the loop that looks at all the arugment types to a
> function.  It starts with the DECL_ARGUMENTS of the function
> declaration.  Look in GCC/gcc/tree.h and GCC/gcc/cp/cp-tree.h for the
> definitions of most GCC internal representation macros.  If you can find
> out how to get back to the original type, then you can modify this loop
> to dump a reference to the typedef node instead of the type.
>
> -Brad



More information about the gccxml mailing list