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 2012-11-11 10:27:27 -08:00
parent 586d5ad43d
commit 5b038020f5
2 changed files with 17 additions and 10 deletions

View file

@ -615,7 +615,8 @@ public class TemplateArgumentDeduction {
private int fPackOffset; private int fPackOffset;
private final int fPackSize; private final int fPackSize;
private TemplateArgumentDeduction(ICPPTemplateParameter[] tpars, CPPTemplateParameterMap explicit, CPPTemplateParameterMap result, int packSize) { private TemplateArgumentDeduction(ICPPTemplateParameter[] tpars, CPPTemplateParameterMap explicit,
CPPTemplateParameterMap result, int packSize) {
fExplicitArgs= explicit; fExplicitArgs= explicit;
fDeducedArgs= result; fDeducedArgs= result;
fPackSize= packSize; fPackSize= packSize;
@ -654,7 +655,8 @@ public class TemplateArgumentDeduction {
/** /**
* Deduces the template parameter mapping from one pair of template arguments. * Deduces the template parameter mapping from one pair of template arguments.
*/ */
private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a, IASTNode point) throws DOMException { private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a, IASTNode point)
throws DOMException {
if (p.isNonTypeValue() != a.isNonTypeValue()) if (p.isNonTypeValue() != a.isNonTypeValue())
return false; return false;
@ -735,7 +737,8 @@ public class TemplateArgumentDeduction {
if (parID >= 0) { if (parID >= 0) {
ICPPTemplateArgument old= fDeducedArgs.getArgument(parID, fPackOffset); ICPPTemplateArgument old= fDeducedArgs.getArgument(parID, fPackOffset);
if (old == null) { if (old == null) {
if (!deduce(parID, new CPPTemplateNonTypeArgument(as, new CPPBasicType(ICPPBasicType.Kind.eInt, 0)))) { if (!deduce(parID,
new CPPTemplateNonTypeArgument(as, new CPPBasicType(ICPPBasicType.Kind.eInt, 0)))) {
return false; return false;
} }
} else if (!as.equals(old.getNonTypeValue())) { } else if (!as.equals(old.getNonTypeValue())) {
@ -761,14 +764,16 @@ public class TemplateArgumentDeduction {
if (p instanceof IQualifierType) if (p instanceof IQualifierType)
return false; return false;
if (remaining != CVQualifier.NONE) { if (remaining != CVQualifier.NONE) {
a= SemanticUtil.addQualifiers(a, remaining.isConst(), remaining.isVolatile(), remaining.isRestrict()); a= SemanticUtil.addQualifiers(a, remaining.isConst(), remaining.isVolatile(),
remaining.isRestrict());
} }
} else if (p instanceof ICPPFunctionType) { } else if (p instanceof ICPPFunctionType) {
if (!(a instanceof ICPPFunctionType)) if (!(a instanceof ICPPFunctionType))
return false; return false;
return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a, point); return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a, point);
} else if (p instanceof ICPPTemplateParameter) { } else if (p instanceof ICPPTemplateParameter) {
ICPPTemplateArgument current= fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset); ICPPTemplateArgument current=
fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);
if (current != null) { if (current != null) {
if (current.isNonTypeValue()) if (current.isNonTypeValue())
return false; return false;
@ -776,7 +781,8 @@ public class TemplateArgumentDeduction {
} }
if (a == null) if (a == null)
return false; return false;
return deduce(((ICPPTemplateParameter) p).getParameterID(), new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution)); return deduce(((ICPPTemplateParameter) p).getParameterID(),
new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution));
} else if (p instanceof ICPPTemplateInstance) { } else if (p instanceof ICPPTemplateInstance) {
if (!(a instanceof ICPPTemplateInstance)) if (!(a instanceof ICPPTemplateInstance))
return false; return false;
@ -791,8 +797,8 @@ public class TemplateArgumentDeduction {
return false; return false;
} }
private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst, IASTNode point) private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst,
throws DOMException { IASTNode point) throws DOMException {
ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst); ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst);
ICPPClassTemplate aTemplate= getPrimaryTemplate(aInst); ICPPClassTemplate aTemplate= getPrimaryTemplate(aInst);
if (pTemplate == null || aTemplate == null) if (pTemplate == null || aTemplate == null)
@ -853,7 +859,8 @@ public class TemplateArgumentDeduction {
return true; return true;
} }
private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta, IASTNode point) throws DOMException { private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta, IASTNode point)
throws DOMException {
if (ftp.isConst() != fta.isConst() || ftp.isVolatile() != fta.isVolatile()) if (ftp.isConst() != fta.isConst() || ftp.isVolatile() != fta.isVolatile())
return false; return false;

View file

@ -90,7 +90,7 @@ public class DeclaratorWriter extends NodeWriter {
private void writeFunctionDeclarator(IASTStandardFunctionDeclarator funcDec) { private void writeFunctionDeclarator(IASTStandardFunctionDeclarator funcDec) {
IASTPointerOperator[] pointOps = funcDec.getPointerOperators(); IASTPointerOperator[] pointOps = funcDec.getPointerOperators();
writePointerOperators(funcDec, pointOps); writePointerOperators(funcDec, pointOps);
// XXX: Lambda declarators happen to have null names rather than empty ones when parsed // Lambda declarators happen to have null names rather than empty ones when parsed.
if (funcDec.getName() != null) { if (funcDec.getName() != null) {
funcDec.getName().accept(visitor); funcDec.getName().accept(visitor);
} }