[GCC-XML] C++ Function Definitions
Brad King
brad.king at kitware.com
Mon Apr 30 20:40:33 EDT 2007
Sandeep Kakarlapudi wrote:
> Can I rely on the fact that definitions are preferred over
> declarations as far as the source location attributes are concerned?
GCC-XML just dumps whatever location the GCC parser produces. I do not
know whether the behavior you observe is reliable. I will say that I've
noticed this behavior too, and that it has never changed since I first
wrote the GCC-XML dump code.
You should probably not trust the line numbers directly. They may not
point to the function body exactly. For that the top-level function
definition complex-statement structure would have to be accessed and
dumped. GCC-XML does not do this since it is not part of the
declaration, if I remember correctly.
I suggest you use the line numbers just to start a search for a
definition, but still use something else to finalize the decision about
adding code.
Out of curiosity, what do you want to add to the beginning of every
function?
-Brad
More information about the gccxml
mailing list