1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Speed up indexer in a situation when there is a large number of

equivalent CPPMethodTemplateSpecialization objects

Change-Id: I3ad05af2de652a109e1680c189b54e81e355d357
This commit is contained in:
Sergey Prigogin 2016-07-27 21:00:04 -07:00
parent 8f2799fa91
commit fdedd70428
2 changed files with 31 additions and 0 deletions

View file

@ -8,9 +8,12 @@
* Contributors:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import java.util.Objects;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
@ -74,4 +77,21 @@ public class CPPFunctionTemplateSpecialization extends CPPFunctionSpecialization
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
return param;
}
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (!getClass().equals(obj.getClass()))
return false;
CPPFunctionTemplateSpecialization other = (CPPFunctionTemplateSpecialization) obj;
return Objects.equals(getSpecializedBinding(), other.getSpecializedBinding())
&& Objects.equals(getOwner(), other.getOwner())
&& Objects.equals(getTemplateParameterMap(), other.getTemplateParameterMap());
}
@Override
public int hashCode() {
return Objects.hash(getSpecializedBinding(), getOwner(), getTemplateParameterMap());
}
}

View file

@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
* Nathan Ridge
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -111,4 +112,14 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
public ICPPClassSpecialization getOwner() {
return (ICPPClassSpecialization) super.getOwner();
}
/**
* Overridden to emphasize that {@link #fTemplateParameters} does not participate in the equality
* relationship.
*/
@SuppressWarnings("javadoc")
@Override
public boolean equals(Object obj) {
return super.equals(obj);
}
}