[GCC-XML]C++ refactorer tool ?
Brad King
brad.king at kitware.com
Mon Jan 6 14:36:03 EST 2003
Hi Philippe,
> I have the idea floating around of a C++ refactorer tool. Would gcc-xml
> be suitable for that ?
>
> The constraint for a refactorer tool is that the must know all the
> structures defined by the program (class, functions, methods, variables,
> structures, arguments, ...) and more importantely where they are defined in
> the source (file, line, column).
>
> After that, the tool is more or less a walker. Once all the references to,
> let's say a method have been found, renaming it is quite simple.
>
> I also have in mind a kind of report tool that would try to estimate the
> complexity of a program, by counting the number of classes, average
> number of methods per classes and stuff like that. For this one, it
> seems that gcc-xml is the perfect tool, isn't it ?
GCC-XML will parse any set of valid C++ sources because it uses a
compiler's parser. All declarations and template instantiations are
dumped with their file name and line number. A program such as what you
have in mind could use this information to look at each line.
However, GCC-XML currently does not support function bodies, so finding
all the references to a method or function would require extra parsing
after reading GCC-XML's output. It also does not dump uninstantiated
class or function templates, so these would be missed unless explicit care
were taken to create instantiations.
-Brad
More information about the gccxml
mailing list