Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C++ Refactoring Tool

Thread Tools

C++ Refactoring Tool

Andre Baresel
Posts: n/a
Hello together,

just a year ago I was searching arround for a tool supporting refactoring
for c++.
I've seen implementations for java and was impressed how an IDE can help
such a feature.

Just rename classes / member / parameter with a mouse click.
reduce the size of a method by transforming parts of it into a seperate
(just by selection and 'do-refactor-out').

But than the bad news - no C++ IDE does support that. Can you imagine why ?
Two arguments I've seen during web search:

- "C++ syntax parsing is hard" I must say - yes it is. Parser
generators don't get it completly.
- "C++ has this nasty preprocessing" Am, yes that makes it a little bit
- "c++ has these template things" Well, declaration constructs can
be a little bit more complex

However, I finally found a project targeting the problem. It is called
"CppTool" on Sourceforge.
A name not very impressive and it started in late 2001. After one year
discussion about how to write
a full c++ parser. Some new members created an idea which convinced me.
Baptiste Lepilleur
(see CppUnit activities) created the idea of doing "lazy parsing". It is a
hand written parser, which is
able to parse only fragments of the code - this is great, since that enables
us to parse only these parts
which we need to know about. An example:

let's say, we know that we are inside a compound statement. that enables us
to seperate all
declaration and statements just by searching for ';' Next step is to decide
if it's a
declaration or statement.

Well, and what to say - after 3 month we have this parser can handle full
files. Not yet getting
all the details, but this is just a question of time.

You will ask - what is there now ?
Important thing first:
- we implemented some simple refactoring (e.g. local variable rename,
split declaration)
- we have an integration for Eclipse and Visual-Studio.
- we are open to any IDE (as long as the IDE is open for

What about these nasty C++ things ?
- the parser does create an AST for C++ Sources
- templates in programs can be parsed
- preprocessing has solved for simple macro replacements
(we keep them as long as they do not conflict a refactoring)

After all, we are only two active programmers. Don't you want to take part
in this
important project ? Just read the mailing lists "cpptool-develop Archive" or
me. I would like to send a first example of the plugins to you.
Check out the sources, well there's much. But just ask me to seperate
important things...

Don't you think that this will be worth ?

See you soon at CppTool:

André Baresel

btw) if you scan through the net in todays time you will also see that the
eclipse project CDT is targeting refactoring, unfortunatly i don't see
on this front and they have even not solved the basic problems. The mile
tell that some very basic rename feature is planned for summer 2004.
I have seen such point also on the time table for this year 2003 - ... I
really like
eclipse, however what is with all there programmers working with borland /
visual studio
because of this COM/ActiveX features.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching tool for clever renaming/refactoring Anonymous user Java 2 01-02-2006 07:35 PM
Refactoring tool... PLEASE Sachin Garg C++ 2 06-24-2004 06:42 PM
come learn all about refactoring Refactorit Java 0 02-22-2004 06:36 PM
C++ Refactoring Tool Andre Baresel C++ 0 01-07-2004 09:42 PM
Refactoring Tool for C++ Tabrez Iqbal C++ 0 09-11-2003 03:46 PM