1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-22 00:15:25 +02:00

Removed redundant qualifiers.

Change-Id: I28dad37e31f471d2e194b0f83098fd8ca1414894
This commit is contained in:
Sergey Prigogin 2016-07-08 15:38:19 -07:00 committed by Gerrit Code Review @ Eclipse.org
parent 0c87249a55
commit 67f2b199d9
2 changed files with 14 additions and 13 deletions

View file

@ -465,7 +465,7 @@ public class CPPSemantics {
// Do not interpret template arguments to a template class as being // Do not interpret template arguments to a template class as being
// explicit template arguments to its templated constructor. // explicit template arguments to its templated constructor.
data.setTemplateArguments(null); data.setTemplateArguments(null);
binding= CPPSemantics.resolveFunction(data, ClassTypeHelper.getConstructors(cls, lookupPoint), true); binding= resolveFunction(data, ClassTypeHelper.getConstructors(cls, lookupPoint), true);
} }
} catch (DOMException e) { } catch (DOMException e) {
return e.getProblem(); return e.getProblem();
@ -2538,7 +2538,7 @@ public class CPPSemantics {
return CPPDeferredFunction.createForCandidates(fns); return CPPDeferredFunction.createForCandidates(fns);
} }
IFunction[] ambiguousFunctions= null; // Ambiguity, 2 functions are equally good. IFunction[] ambiguousFunctions= null; // Ambiguity, two or more functions are equally good.
FunctionCost bestFnCost = null; // The cost of the best function. FunctionCost bestFnCost = null; // The cost of the best function.
// Loop over all functions // Loop over all functions
@ -3005,7 +3005,7 @@ public class CPPSemantics {
LookupData data= new LookupData(name); LookupData data= new LookupData(name);
data.setFunctionArguments(false, init.getArguments()); data.setFunctionArguments(false, init.getArguments());
try { try {
IBinding ctor = CPPSemantics.resolveFunction(data, IBinding ctor = resolveFunction(data,
ClassTypeHelper.getConstructors((ICPPClassType) targetType, name), true); ClassTypeHelper.getConstructors((ICPPClassType) targetType, name), true);
if (ctor instanceof ICPPConstructor) { if (ctor instanceof ICPPConstructor) {
int i= 0; int i= 0;
@ -3964,13 +3964,13 @@ public class CPPSemantics {
// Find all bindings that match the first part of the name. For each such binding, // Find all bindings that match the first part of the name. For each such binding,
// lookup the second part of the name. // lookup the second part of the name.
for (IBinding binding : CPPSemantics.findBindings(scope, part1, false)) { for (IBinding binding : findBindings(scope, part1, false)) {
findBindingsForQualifiedName(getLookupScope(binding), part2, bindings); findBindingsForQualifiedName(getLookupScope(binding), part2, bindings);
} }
} }
private static ICPPScope getNamespaceScope(CPPASTTranslationUnit tu, String[] namespaceParts, IASTNode point) private static ICPPScope getNamespaceScope(CPPASTTranslationUnit tu, String[] namespaceParts,
throws DOMException { IASTNode point) throws DOMException {
ICPPScope nsScope= tu.getScope(); ICPPScope nsScope= tu.getScope();
outer: for (String nsPart : namespaceParts) { outer: for (String nsPart : namespaceParts) {
nsPart= nsPart.trim(); nsPart= nsPart.trim();
@ -4099,7 +4099,8 @@ public class CPPSemantics {
} else { } else {
if (function instanceof ICPPTemplateDefinition) { if (function instanceof ICPPTemplateDefinition) {
final ICPPTemplateDefinition funcTemplate = (ICPPTemplateDefinition) function; final ICPPTemplateDefinition funcTemplate = (ICPPTemplateDefinition) function;
if (!isSameTemplateParameterList(funcTemplate.getTemplateParameters(), templateDecl.getTemplateParameters())) { if (!isSameTemplateParameterList(funcTemplate.getTemplateParameters(),
templateDecl.getTemplateParameters())) {
return false; return false;
} }
} else { } else {
@ -4118,7 +4119,8 @@ public class CPPSemantics {
return false; return false;
} }
private static boolean isSameTemplateParameterList(ICPPTemplateParameter[] tplist, ICPPASTTemplateParameter[] tps) { private static boolean isSameTemplateParameterList(ICPPTemplateParameter[] tplist,
ICPPASTTemplateParameter[] tps) {
if (tplist.length != tps.length) if (tplist.length != tps.length)
return false; return false;

View file

@ -966,7 +966,7 @@ public class CPPTemplates {
} // else reuse last parameter (which should be a pack) } // else reuse last parameter (which should be a pack)
@SuppressWarnings("null") @SuppressWarnings("null")
IValue defaultValue = par.getDefaultValue(); IValue defaultValue = par.getDefaultValue();
IValue specializedValue = CPPTemplates.instantiateValue(defaultValue, context, maxdepth); IValue specializedValue = instantiateValue(defaultValue, context, maxdepth);
result[i] = new CPPParameterSpecialization(par, functionSpec, specializedParameterTypes[i], result[i] = new CPPParameterSpecialization(par, functionSpec, specializedParameterTypes[i],
specializedValue, context.getParameterMap()); specializedValue, context.getParameterMap());
} }
@ -998,7 +998,7 @@ public class CPPTemplates {
} else if (decl instanceof ICPPClassTemplate) { } else if (decl instanceof ICPPClassTemplate) {
ICPPClassTemplate template = (ICPPClassTemplate) decl; ICPPClassTemplate template = (ICPPClassTemplate) decl;
CPPClassTemplateSpecialization classTemplateSpec = new CPPClassTemplateSpecialization(template, owner, tpMap); CPPClassTemplateSpecialization classTemplateSpec = new CPPClassTemplateSpecialization(template, owner, tpMap);
classTemplateSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(classTemplateSpec, classTemplateSpec.setTemplateParameters(specializeTemplateParameters(classTemplateSpec,
(ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), owner, point)); (ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), owner, point));
spec = classTemplateSpec; spec = classTemplateSpec;
} else if (decl instanceof ICPPClassType) { } else if (decl instanceof ICPPClassType) {
@ -1016,7 +1016,7 @@ public class CPPTemplates {
if (decl instanceof ICPPFieldTemplate) { if (decl instanceof ICPPFieldTemplate) {
CPPFieldTemplateSpecialization fieldTempSpec = new CPPFieldTemplateSpecialization(decl, CPPFieldTemplateSpecialization fieldTempSpec = new CPPFieldTemplateSpecialization(decl,
owner, tpMap, type, value); owner, tpMap, type, value);
ICPPTemplateParameter[] params = CPPTemplates.specializeTemplateParameters(fieldTempSpec, ICPPTemplateParameter[] params = specializeTemplateParameters(fieldTempSpec,
(ICPPScope) fieldTempSpec.getScope(), (ICPPScope) fieldTempSpec.getScope(),
((ICPPFieldTemplate) decl).getTemplateParameters(), owner, point); ((ICPPFieldTemplate) decl).getTemplateParameters(), owner, point);
fieldTempSpec.setTemplateParameters(params); fieldTempSpec.setTemplateParameters(params);
@ -1041,7 +1041,7 @@ public class CPPTemplates {
methodSpec = new CPPMethodTemplateSpecialization((ICPPMethod) decl, owner, tpMap, methodSpec = new CPPMethodTemplateSpecialization((ICPPMethod) decl, owner, tpMap,
type, exceptionSpecs); type, exceptionSpecs);
} }
methodSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(methodSpec, methodSpec.setTemplateParameters(specializeTemplateParameters(methodSpec,
(ICPPScope) methodSpec.getScope(), (ICPPScope) methodSpec.getScope(),
((ICPPFunctionTemplate) decl).getTemplateParameters(), owner, point)); ((ICPPFunctionTemplate) decl).getTemplateParameters(), owner, point));
functionSpec = methodSpec; functionSpec = methodSpec;
@ -1443,7 +1443,6 @@ public class CPPTemplates {
TypeInstantiationRequest instantiationRequest = new TypeInstantiationRequest(type, context); TypeInstantiationRequest instantiationRequest = new TypeInstantiationRequest(type, context);
if (!instantiationsInProgress.get().add(instantiationRequest)) { if (!instantiationsInProgress.get().add(instantiationRequest)) {
System.out.println("Recursion in instantiation of type \"" + type + "\""); //$NON-NLS-1$//$NON-NLS-2$ //XXX
return type instanceof ICPPFunctionType ? return type instanceof ICPPFunctionType ?
ProblemFunctionType.RECURSION_IN_LOOKUP : ProblemType.RECURSION_IN_LOOKUP; ProblemFunctionType.RECURSION_IN_LOOKUP : ProblemType.RECURSION_IN_LOOKUP;
} }