This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Refactoring tool
- From: Patrick Flannery <foster_flannery at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 22 Jul 2007 05:28:00 -0700 (PDT)
- Subject: Refactoring tool
gcc,
Recently I have been interested in creating an open source refactoring tool. I did not have much luck
finding an application that does what I need and thought that I could get some feedback
from the gcc community. In particular I would like to add a flag which would cause gcc to emit symbol definition and use
information. The -fdump-* flags provide much of this information in various formats. I would like to combine the salient
information into a denser binary format that could be consumed by a subsequent application which would then modify the
original source text. I would like this second application to be a command line tool which uses a syntax similar to gdb.
For example "show unused headers in test.cpp" would print the header files which were included but not required in test.cpp.
I have been able to come up with a small set of functions that I would like to be available, these include:
rename [function|class|variable]+ [in scope] old_name new_name //rename a function or variable or class
move [function|class|variable]+ to file //move a function class or variable definition to a different source code location
remove using [namespace name] from file //fully qualify each symbol use with the appropriate namespace
create function from file.begin_line file.end_line //create a function out of a block of code
Having spent some time looking at the code for gcc it seems reasonably easy(with some suggestions) to traverse the tree generated and
write the relevant information to a file. Any suggestions or pointers to related work would be much appreciated.
Patrick
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php