[GCC-XML] Not Forgetting Original Typedefs

Brad King brad.king at kitware.com
Thu Jul 29 10:33:40 EDT 2004


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