Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Re: [cdt-patch] FW: c/c++ refactoring contribution

Warning: Your file,, contains more than 32 files after decompression and cannot be scanned.

Great work, Markus! This is definitely going in the direction I was hoping 
to see, i.e., maximize reuse of the LTK and the CDT DOM.

I have committed this with one minor change (i.e. the removal of the 
assert since we haven't moved to Java 1.5 yet). It can be found in the 
org.eclipse.cdt-core folder in /home/tools. If anyone feels that this is 
the wrong place for it, please step forward and we can have that debate 
and a proper vote on it.

I have not added this to the cdt feature since the LTK still has the 
dependency on JDT. Once that is removed we can have a debate and vote on 
whether to add it in so all CDT users get it. From what I've seen so far, 
it is going to be a lot better than the current rename refactoring.

One thing to watch out for, Markus and everyone working on this feature, 
is scalability. An interesting exercise would be to try this out on our 
standard large project, i.e., Mozilla, and see what happens to memory 
consumption. I noticed that you are caching the ASTs during the 
refactoring. This could get large if you find a lot of files that match.

Doug Schaefer
Ottawa Lab, IBM Rational Software Division

"Schorn, Markus" <Markus.Schorn@xxxxxxxxxxxxx> 
Sent by: cdt-patch-admin@xxxxxxxxxxx
03/09/2005 09:16 AM
Please respond to


[cdt-patch] FW: c/c++ refactoring contribution

Warning: Your file,, contains more than 32 
files after decompression and cannot be scanned.

here is my initial contribution for c/c++ refactoring. You may want to
pass on some of the info to the community when putting the code into
the CVS repository.
This does not come as CVS patch, as this is not a change to an

existing plugin.

  + org.eclipse.cdt.refactoring
     + src
        + org.eclipse.cdt.internal.refactoring
        + org.eclipse.cdt.internal.refactoring.scanner
        + org.eclipse.cdt.internal.refactoring.ui
        + org.eclipse.cdt.refactoring
  + org.eclipse.cdt.refactoring.tests
     + src
        + org.eclipse.cdt.core.tests

        + org.eclipse.cdt.refactoring.tests

As the cdt.refactoring plugin depends on ltk.ui.refactoring there is
an implicit dependency on jdt.core. See

The code is licensed under the EPL, if that is not apropriate I could
change that.
I use a header slightly different to the one used inside CDT. It is the
one suggested at
(and the one approved by my legal department).

Test cases:
I have ported the existing test cases for renaming to the new

implementation and started to extend them with further tests.

There will be more to do for me.

The core of the rename-refactoring is implemented. Regression tests that
passed with the old version also pass with the new version. There is one
exception to that for which I'll file a bug today.

The new version additionally fixes the bugs: 72612, 72717, 72605, 79231,

79282, 79295, 72620, 72617.

It is possible to register renaming participants with the same extension
point jdt is using. One of the regression tests shows how to do this.
This could be of interest to the debugger (renaming a function with a

breakpoint sitting on it?)

Undo/Redo is working by means of the refactoring framework. To check it
out you have to enable the 'Java Coding' Action Set in your perspective.

Effects on the GUI:
The plugin adds a menu item to the context menu of the CDT-Editor.
(Refactoring - Rename (work in progress)).

What's next:
Starting after Easter I plan to

* finish the checks for shadowing/redeclaring vars/funcs/types.
* extend test cases.
* handle macros.
* extend test cases.
* integrate new rename, undo and redo into the GUI.
* remove old renaming facility.


Description: Zip archive

Back to the top