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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-03-01 06:38:28 +00:00
parent a71b6c6659
commit 45a77d5da4
2 changed files with 18 additions and 21 deletions

View file

@ -163,8 +163,10 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
if (fdecl != null) { if (fdecl != null) {
IASTParameterDeclaration[] params = fdecl.getParameters(); IASTParameterDeclaration[] params = fdecl.getParameters();
int size = params.length; int size = params.length;
if (size == 0) {
return ICPPParameter.EMPTY_CPPPARAMETER_ARRAY;
}
ICPPParameter[] result = new ICPPParameter[size]; ICPPParameter[] result = new ICPPParameter[size];
if (size > 0) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
IASTParameterDeclaration p = params[i]; IASTParameterDeclaration p = params[i];
final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName(); final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName();
@ -176,13 +178,11 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray()); IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
} }
} }
}
return result; return result;
} }
return CPPBuiltinParameter.createParameterList(getType()); return CPPBuiltinParameter.createParameterList(getType());
} }
public int getRequiredArgumentCount() throws DOMException { public int getRequiredArgumentCount() throws DOMException {
return CPPFunction.getRequiredArgumentCount(getParameters()); return CPPFunction.getRequiredArgumentCount(getParameters());
} }

View file

@ -193,7 +193,7 @@ public class TemplateArgumentDeduction {
// 14.8.2.1-2 // 14.8.2.1-2
if (par instanceof ICPPReferenceType) { if (par instanceof ICPPReferenceType) {
// If P is an rvalue reference to a cv-unqualified template parameter and the argument is an // If P is an rvalue reference to a cv-unqualified template parameter and the argument is an
// lvalue, the type A& lvalue reference to A is used in place of A for type deduction. // lvalue, the type A& lvalue reference to A is used in place of A for type deduction.
isReferenceTypeParameter= true; isReferenceTypeParameter= true;
final ICPPReferenceType refPar = (ICPPReferenceType) par; final ICPPReferenceType refPar = (ICPPReferenceType) par;
if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) { if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) {
@ -290,7 +290,6 @@ public class TemplateArgumentDeduction {
return null; return null;
} }
private static ICPPClassTemplate getPrimaryTemplate(ICPPTemplateInstance inst) throws DOMException { private static ICPPClassTemplate getPrimaryTemplate(ICPPTemplateInstance inst) throws DOMException {
ICPPTemplateDefinition template= inst.getTemplateDefinition(); ICPPTemplateDefinition template= inst.getTemplateDefinition();
if (template instanceof ICPPClassTemplatePartialSpecialization) { if (template instanceof ICPPClassTemplatePartialSpecialization) {
@ -328,7 +327,6 @@ public class TemplateArgumentDeduction {
return result; return result;
} }
/** /**
* Deduces the template parameter mapping from pairs of template arguments. * Deduces the template parameter mapping from pairs of template arguments.
*/ */
@ -346,7 +344,6 @@ public class TemplateArgumentDeduction {
return verifyDeduction(pars, map, false); return verifyDeduction(pars, map, false);
} }
private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap, boolean useDefaults) { private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap, boolean useDefaults) {
for (ICPPTemplateParameter tpar : pars) { for (ICPPTemplateParameter tpar : pars) {
if (tpar.isParameterPack()) { if (tpar.isParameterPack()) {