[GCC-XML] Tag location for function and method.

James Fowler boost_list at openseaconsulting.com
Tue Feb 22 15:19:30 EST 2005


Brad King wrote:

> Brice Orsaud wrote:
>
>> In XML the tag location for a function stands for the file where the 
>> function is defined. In my case I would like to change this file by 
>> file where the function is declared (if it exists). I would like to 
>> know if it’s possible, and what files are impacted by this modification.
>
>
> I doubt it's possible because the declaration can be in more than one 
> place but there can be only one definition.  You might be able to 
> reverse-engineer how GCC deals with multiple declarations by dumping 
> toy examples in which you duplicate a function declaration in more 
> than one header file and leave out the definition completely.  Source 
> files in GCC-XML that may help you are GCC/gcc/cp/cp-tree.h and 
> GCC/gcc/cp/xml.c.

I'm pretty sure Brad's right about this being impossible (at least,
without modifying GCC to save additional state in the parse tree).  I've
spent some time looking for the same thing (location of declaration when
GCC has seen definition) and haven't found it.  Once the definition is
seen, the location for the declaration(s) is apparently lost.

One thing that might help: remember that this is not a problem if GCC
only sees the declaration.  If you can parse just the header file
separately from the .cpp file, that should give you the location in
which it was declared (assuming you aren't stuck with the declaration
and definition in the same file...).   I suspect that this is the
simplest way to get the location of the declaration.

- James

> -Brad
> _______________________________________________
> gccxml mailing list
> gccxml at gccxml.org
> http://www.gccxml.org/mailman/listinfo/gccxml
>
>


-- 
__________________________________________________________
  James Fowler, Open Sea Consulting
  http://www.OpenSeaConsulting.com, Marietta, Georgia, USA
  Do C++ Right.  http://www.OpenCpp.org, opening soon!




More information about the gccxml mailing list