1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-08 17:45:24 +02:00

Bug 45203. Special handling for user-provided hash functors.

This commit is contained in:
Sergey Prigogin 2013-08-05 20:01:33 -07:00
parent 9b03c5aa82
commit bdcf204257

View file

@ -91,7 +91,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.index.IIndexMacro; import org.eclipse.cdt.core.index.IIndexMacro;
import org.eclipse.cdt.core.index.IndexFilter; import org.eclipse.cdt.core.index.IndexFilter;
@ -276,9 +278,20 @@ public class BindingClassifier {
} }
if (binding instanceof ICPPSpecialization) { if (binding instanceof ICPPSpecialization) {
ICPPTemplateParameterMap parameterMap = ((ICPPSpecialization) binding).getTemplateParameterMap();
for (Integer position : parameterMap.getAllParameterPositions()) {
ICPPTemplateArgument argument = parameterMap.getArgument(position);
IType type = argument.getTypeValue();
// Normally we don't need to define parameters of a template specialization that
// were not specified explicitly. __gnu_cxx::hash is an exception from that rule.
if (type instanceof IBinding && "hash".equals(((IBinding) type).getName())) { //$NON-NLS-1$
IBinding owner = ((IBinding) type).getOwner();
if (owner instanceof ICPPNamespace && "__gnu_cxx".equals(owner.getName())) //$NON-NLS-1$
bindings.add((IBinding) type);
}
}
// Get the specialized binding - e.g. get the binding for X if the current binding is // Get the specialized binding - e.g. get the binding for X if the current binding is
// for the template specialization X<Y>. Resolution of the specialization // for the template specialization X<Y>.
// (i.e. template) arguments is handled separately by the caller of this method.
binding = ((ICPPSpecialization) binding).getSpecializedBinding(); binding = ((ICPPSpecialization) binding).getSpecializedBinding();
} }