Community
Participate
Working Groups
Build Identifier: I20100608-0911 struct ClassWithCCtor { ClassWithCCtor(); ClassWithCCtor(const ClassWithCCtor&); }; For above code "Rename refactoring" for type ClassWithCCtor should be executed when "Rename refactoring" is called with cursor standing on any "ClassWithCCtor" token. It can be type identifier in struct declaration, type reference in copy constructor parameter declaration, or the constructor declarations. The later case isn't working and there are "constructor cannot be renamed" message box appearing instead. Being formally correct this message box is useless and it will be much better to just open refactoring dialog for "ClassWithCCtor" type. Reproducible: Always
Created attachment 226804 [details] Swtich the binding for renaming of ctor's and dtor's to rename the class Since the CRenameMethodProcessor processor delegate will not rename a constructor or a destructor for a class I added some code to CRenameProcessor to change the argument's IBinding to point to the class instead. Using ICPPMember.getClassOwner() method to update the binding before the processor delegate is created means that CRenameProcessor will create a CRenameClassProcessor processor delegate instead and the class will be renamed. I added a private method updateBinding to handle this update (and any future updates) but if anyone has a better name please suggest one. The new updateBinding method is being called from CRenameProcessor.checkInitialConditions just before the processor delegate factory method is invoked. I have tested renaming all the tokens mentioned in the defect in both the .h and .cpp files. I have also checked that the dialog and the preview works as well. Please let me know if there are any other areas I should test in addition.
(In reply to comment #1) Thank you for providing the patch. Could you please add a test case to org.eclipse.cdt.ui.tests.refactoring.rename.RenameTypeTests and push the updated change to Gerrit (http://wiki.eclipse.org/CDT/git#Using_Gerrit_for_CDT).
Created attachment 227265 [details] Update patch to include test cases I am unable to connect to Gerrit from my dev environment at the moment. I can access it via the web but neither https nor ssh connections work from in Eclipse. While I am working on sorting that out here is an updated patch with test cases.
This is still an issue with 9.4.2 / Photon M6. See also https://github.com/LegalizeAdulthood/refactor-test-suite Rename.cpp testcases R2 and R32. The workaround is obviously press F3 to navigate to the class declaration, then refactor from there. But other tools (like Visual Studio 2017) can apparently handle the case, it would be nice to get the patch applied. See https://github.com/LegalizeAdulthood/refactor-test-suite/blob/master/results/VisualStudio2017Results.md
Ian, have you had any luck getting Gerrit to work? If you're still having trouble, please let us know what error you are seeing, and we can try to help.
New Gerrit change created: https://git.eclipse.org/r/120112
Ian indicated to me over email that he no longer has a development environment for this set up, so I submitted the patch to Gerrit on his behalf.
Gerrit change https://git.eclipse.org/r/120112 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=91a142fcb71d924425168cd31e268700abbf9eb1
Fixed for 9.5.