mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
a71b6c6659
commit
45a77d5da4
2 changed files with 18 additions and 21 deletions
|
@ -163,18 +163,19 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
if (fdecl != null) {
|
||||
IASTParameterDeclaration[] params = fdecl.getParameters();
|
||||
int size = params.length;
|
||||
if (size == 0) {
|
||||
return ICPPParameter.EMPTY_CPPPARAMETER_ARRAY;
|
||||
}
|
||||
ICPPParameter[] result = new ICPPParameter[size];
|
||||
if (size > 0) {
|
||||
for(int i = 0; i < size; i++) {
|
||||
IASTParameterDeclaration p = params[i];
|
||||
final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName();
|
||||
final IBinding binding= pname.resolveBinding();
|
||||
if (binding instanceof ICPPParameter) {
|
||||
result[i]= (ICPPParameter) binding;
|
||||
} else {
|
||||
result[i] = new CPPParameter.CPPParameterProblem(p,
|
||||
IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
IASTParameterDeclaration p = params[i];
|
||||
final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName();
|
||||
final IBinding binding= pname.resolveBinding();
|
||||
if (binding instanceof ICPPParameter) {
|
||||
result[i]= (ICPPParameter) binding;
|
||||
} else {
|
||||
result[i] = new CPPParameter.CPPParameterProblem(p,
|
||||
IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -182,7 +183,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
return CPPBuiltinParameter.createParameterList(getType());
|
||||
}
|
||||
|
||||
|
||||
public int getRequiredArgumentCount() throws DOMException {
|
||||
return CPPFunction.getRequiredArgumentCount(getParameters());
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
if (type == null) {
|
||||
IASTName name = getTemplateName();
|
||||
IASTNode parent = name.getParent();
|
||||
while(parent.getParent() instanceof IASTDeclarator)
|
||||
while (parent.getParent() instanceof IASTDeclarator)
|
||||
parent = parent.getParent();
|
||||
|
||||
|
||||
IType temp = getNestedType(CPPVisitor.createType((IASTDeclarator)parent), TDEF);
|
||||
if (temp instanceof ICPPFunctionType)
|
||||
type = (ICPPFunctionType) temp;
|
||||
|
|
|
@ -171,7 +171,7 @@ public class TemplateArgumentDeduction {
|
|||
par= fnPars[j];
|
||||
if (par instanceof ICPPParameterPackType) {
|
||||
// must be the last parameter.
|
||||
if (j != fnParCount-1)
|
||||
if (j != fnParCount - 1)
|
||||
return false;
|
||||
|
||||
par= fnParPack= ((ICPPParameterPackType) par).getType();
|
||||
|
@ -193,7 +193,7 @@ public class TemplateArgumentDeduction {
|
|||
// 14.8.2.1-2
|
||||
if (par instanceof ICPPReferenceType) {
|
||||
// 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;
|
||||
final ICPPReferenceType refPar = (ICPPReferenceType) par;
|
||||
if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) {
|
||||
|
@ -290,7 +290,6 @@ public class TemplateArgumentDeduction {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static ICPPClassTemplate getPrimaryTemplate(ICPPTemplateInstance inst) throws DOMException {
|
||||
ICPPTemplateDefinition template= inst.getTemplateDefinition();
|
||||
if (template instanceof ICPPClassTemplatePartialSpecialization) {
|
||||
|
@ -328,7 +327,6 @@ public class TemplateArgumentDeduction {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deduces the template parameter mapping from pairs of template arguments.
|
||||
*/
|
||||
|
@ -338,7 +336,7 @@ public class TemplateArgumentDeduction {
|
|||
if (p == null || p.length != len) {
|
||||
return false;
|
||||
}
|
||||
for (int j=0; j<len; j++) {
|
||||
for (int j= 0; j < len; j++) {
|
||||
if (!deduct.fromTemplateArgument(p[j], a[j])) {
|
||||
return false;
|
||||
}
|
||||
|
@ -346,7 +344,6 @@ public class TemplateArgumentDeduction {
|
|||
return verifyDeduction(pars, map, false);
|
||||
}
|
||||
|
||||
|
||||
private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap, boolean useDefaults) {
|
||||
for (ICPPTemplateParameter tpar : pars) {
|
||||
if (tpar.isParameterPack()) {
|
||||
|
@ -622,7 +619,7 @@ public class TemplateArgumentDeduction {
|
|||
p= pParams[i];
|
||||
if (p instanceof ICPPParameterPackType) {
|
||||
p= parameterPack= ((ICPPParameterPackType) p).getType();
|
||||
deduct= new TemplateArgumentDeduction(this, aParams.length-i);
|
||||
deduct= new TemplateArgumentDeduction(this, aParams.length - i);
|
||||
p= CPPTemplates.instantiateType(p, fExplicitArgs, deduct.fPackOffset, null);
|
||||
if (!CPPTemplates.isValidType(p))
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue