[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gccxml
Subject:    Re: [GCC-XML]C++ refactorer tool ?
From:       Brad King <brad.king () kitware ! com>
Date:       2003-01-06 19:36:03
Message-ID: Pine.LNX.4.44.0301061430070.10535-100000 () hythloth ! kitwarein ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic