mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Cosmetics.
This commit is contained in:
parent
fa7aff1975
commit
4d2a57889c
6 changed files with 22 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2013 Google, Inc and others.
|
||||
* Copyright (c) 2012, 2014 Google, Inc and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -30,10 +30,10 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBinding getTemplateDefinition() {
|
||||
public IBinding getTemplateDefinition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public char[] getSignature() {
|
||||
SignatureBuilder buf = new SignatureBuilder();
|
||||
|
@ -91,7 +91,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected static boolean areAllConstantExpressions(ICPPEvaluation[] evaluations, IASTNode point) {
|
||||
for (ICPPEvaluation eval : evaluations) {
|
||||
if (!eval.isConstantExpression(point)) {
|
||||
|
@ -100,7 +100,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected static boolean isConstexprValue(IValue value, IASTNode point) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
|
@ -111,8 +111,8 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
|||
}
|
||||
return innerEval.isConstantExpression(point);
|
||||
}
|
||||
|
||||
protected static boolean isConstexprFuncOrNull(ICPPFunction function) {
|
||||
|
||||
protected static boolean isNullOrConstexprFunc(ICPPFunction function) {
|
||||
return function == null || function.isConstexpr();
|
||||
}
|
||||
}
|
|
@ -191,7 +191,7 @@ public class EvalBinary extends CPPDependentEvaluation {
|
|||
public boolean isConstantExpression(IASTNode point) {
|
||||
return fArg1.isConstantExpression(point)
|
||||
&& fArg2.isConstantExpression(point)
|
||||
&& isConstexprFuncOrNull(getOverload(point));
|
||||
&& isNullOrConstexprFunc(getOverload(point));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -79,7 +79,7 @@ public class EvalComma extends CPPDependentEvaluation {
|
|||
return false;
|
||||
}
|
||||
for (ICPPFunction overload : fOverloads) {
|
||||
if (!isConstexprFuncOrNull(overload)) {
|
||||
if (!isNullOrConstexprFunc(overload)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class EvalFunctionCall extends CPPDependentEvaluation {
|
|||
@Override
|
||||
public boolean isConstantExpression(IASTNode point) {
|
||||
return areAllConstantExpressions(fArguments, point)
|
||||
&& isConstexprFuncOrNull(getOverload(point));
|
||||
&& isNullOrConstexprFunc(getOverload(point));
|
||||
}
|
||||
|
||||
public ICPPFunction getOverload(IASTNode point) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
private final ICPPEvaluation[] fArguments;
|
||||
private final boolean fRepresentsNewExpression;
|
||||
private IType fOutputType;
|
||||
|
||||
|
||||
private ICPPFunction fConstructor = CPPFunction.UNINITIALIZED_FUNCTION;
|
||||
private boolean fCheckedIsTypeDependent;
|
||||
private boolean fIsTypeDependent;
|
||||
|
@ -56,7 +56,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
public EvalTypeId(IType type, IBinding templateDefinition, ICPPEvaluation... arguments) {
|
||||
this(type, templateDefinition, false, arguments);
|
||||
}
|
||||
|
||||
|
||||
private EvalTypeId(IType type, IBinding templateDefinition, boolean forNewExpression, ICPPEvaluation... arguments) {
|
||||
super(templateDefinition);
|
||||
if (arguments == null)
|
||||
|
@ -146,25 +146,25 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
public boolean isConstantExpression(IASTNode point) {
|
||||
return !fRepresentsNewExpression
|
||||
&& areAllConstantExpressions(fArguments, point)
|
||||
&& isConstexprFuncOrNull(getConstructor(point));
|
||||
&& isNullOrConstexprFunc(getConstructor(point));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueCategory getValueCategory(IASTNode point) {
|
||||
return valueCategoryFromReturnType(fInputType);
|
||||
}
|
||||
|
||||
|
||||
public ICPPFunction getConstructor(IASTNode point) {
|
||||
if (fConstructor == CPPFunction.UNINITIALIZED_FUNCTION) {
|
||||
fConstructor = computeConstructor(point);
|
||||
}
|
||||
return fConstructor;
|
||||
}
|
||||
|
||||
|
||||
private ICPPFunction computeConstructor(IASTNode point) {
|
||||
if (isTypeDependent())
|
||||
return null;
|
||||
|
||||
|
||||
IType simplifiedType = SemanticUtil.getNestedType(fInputType, SemanticUtil.TDEF);
|
||||
if (simplifiedType instanceof ICPPClassType) {
|
||||
ICPPClassType classType = (ICPPClassType) simplifiedType;
|
||||
|
@ -220,9 +220,9 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
IType type = CPPTemplates.instantiateType(fInputType, tpMap, packOffset, within, point);
|
||||
if (args == fArguments && type == fInputType)
|
||||
return this;
|
||||
|
||||
|
||||
EvalTypeId result = new EvalTypeId(type, getTemplateDefinition(), fRepresentsNewExpression, args);
|
||||
|
||||
|
||||
if (!result.isTypeDependent()) {
|
||||
IType simplifiedType = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
|
||||
if (simplifiedType instanceof ICPPClassType) {
|
||||
|
@ -234,13 +234,13 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap,
|
||||
int maxdepth, IASTNode point) {
|
||||
public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap, int maxdepth,
|
||||
IASTNode point) {
|
||||
ICPPEvaluation[] args = fArguments;
|
||||
for (int i = 0; i < fArguments.length; i++) {
|
||||
ICPPEvaluation arg = fArguments[i].computeForFunctionCall(parameterMap, maxdepth, point);
|
||||
|
|
|
@ -148,7 +148,7 @@ public class EvalUnary extends CPPDependentEvaluation {
|
|||
@Override
|
||||
public boolean isConstantExpression(IASTNode point) {
|
||||
return fArgument.isConstantExpression(point)
|
||||
&& isConstexprFuncOrNull(getOverload(point));
|
||||
&& isNullOrConstexprFunc(getOverload(point));
|
||||
}
|
||||
|
||||
public ICPPFunction getOverload(IASTNode point) {
|
||||
|
|
Loading…
Add table
Reference in a new issue