Bug 240692 - [Refactoring] Rename on func-tmpl misses some specializations
Summary: [Refactoring] Rename on func-tmpl misses some specializations
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 5.0   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
: 316567 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-14 11:25 EDT by Markus Schorn CLA
Modified: 2020-09-04 15:27 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Schorn CLA 2008-07-14 11:25:17 EDT
 
Comment 1 Markus Schorn CLA 2008-07-14 11:28:35 EDT
When renaming a template all specializations have to be renamed, too. This works only when a template-id is used to name a instance, it does not work for specializations. See bug 240589 for a code snippet.
Comment 2 Jesse Weinstein CLA 2013-03-11 18:02:18 EDT
Here's a test case that seems to show the problem, as I understand it.

https://git.eclipse.org/r/11064

The code is:

template <class T>
class CSome {
public:
    void Foo () {}; //Rename run here.
};

int main ()
{
    CSome <int> A;
    A.Foo();
    return 0;
}


Looking into it, it seems like the problem is that the first reference is given the AST type CPPMethod, but the 2nd is CPPMethodSpecialization, which, while they share some interfaces, they are not recongized by org.eclipse.cdt.internal.ui.refactoring.rename.ASTManager.fKnownBindings as being the same. This causes org.eclipse.cdt.internal.ui.refactoring.rename.ASTManager.analyzeAstTextMatchPair(CRefactoringMatch, IASTName, RefactoringStatus) to assign the 2nd one the CRefactoringMatch.AST_REFERENCE_OTHER status, which causes it to be ignored.

I'm not yet sure how this should be fixed...
Comment 3 Jesse Weinstein CLA 2013-04-08 14:55:31 EDT
Looking into it more, the place where CPPMethodSpecialization and CPPMethod are seen as non-matching is in org.eclipse.cdt.internal.ui.refactoring.rename.ASTManager.isSameBinding(IIndex, IBinding, IBinding) , specifically within org.eclipse.cdt.internal.ui.refactoring.rename.ASTManager.isSameScope(IScope, IScope, boolean) where the names of the two scopes don't match (since one has the template parameter filled in). 

I'm not sure what should be changed within there to make them match...
Comment 4 Marc-André Laperle CLA 2013-04-22 23:15:18 EDT
*** Bug 316567 has been marked as a duplicate of this bug. ***