[GCC-XML]Endline of a method

Brad King brad.king at kitware.com
Tue Aug 5 12:31:04 EDT 2003


Iwan,

> I want to use GCC_XML for code transformation (Adding code at the
> beginning and at the end of a method plus adding attributes a class). To
> do that I need the line of the beginning of a method
> declaration/definition and the end of the method declaration/definition.
> The generated XML from GCC_XML only privides the beginning line of the
> method declaration/definition. Is it somehow possible to have the end
> line as well? Or somebody even know a better way to for transforming
> methods in c++ source code.

GCC does not internally store the ending line, so GCC-XML cannot dump it.
You can't just blindly add code after/before lines, though, because of
code like this:

void foo() {}
int bar() {int x=0;
return x;}

You'll have to write a curly-matching parser that starts with the line
given by GCC-XML's dump.

-Brad




More information about the gccxml mailing list