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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2016-01-21 17:32:10 -08:00
parent 7b6cbde517
commit c5ecc6fe90
3 changed files with 11 additions and 14 deletions

View file

@ -58,7 +58,6 @@ import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
@ -93,7 +92,6 @@ public class Value implements IValue {
// Value.ERROR indicates that an error, such as a substitution failure, occurred during evaluation. // Value.ERROR indicates that an error, such as a substitution failure, occurred during evaluation.
public static final Value ERROR= new Value("<error>".toCharArray(), null); //$NON-NLS-1$ public static final Value ERROR= new Value("<error>".toCharArray(), null); //$NON-NLS-1$
public static final Value NOT_INITIALIZED= new Value("<__>".toCharArray(), null); //$NON-NLS-1$ public static final Value NOT_INITIALIZED= new Value("<__>".toCharArray(), null); //$NON-NLS-1$
private static final IType INT_TYPE= new CPPBasicType(ICPPBasicType.Kind.eInt, 0);
private static final Number VALUE_CANNOT_BE_DETERMINED = new Number() { private static final Number VALUE_CANNOT_BE_DETERMINED = new Number() {
@Override @Override
@ -300,7 +298,7 @@ public class Value implements IValue {
return create(val.longValue() + increment); return create(val.longValue() + increment);
} }
ICPPEvaluation arg1 = value.getEvaluation(); ICPPEvaluation arg1 = value.getEvaluation();
EvalFixed arg2 = new EvalFixed(INT_TYPE, ValueCategory.PRVALUE, create(increment)); EvalFixed arg2 = new EvalFixed(CPPBasicType.INT, ValueCategory.PRVALUE, create(increment));
return create(new EvalBinary(IASTBinaryExpression.op_plus, arg1, arg2, arg1.getTemplateDefinition())); return create(new EvalBinary(IASTBinaryExpression.op_plus, arg1, arg2, arg1.getTemplateDefinition()));
} }

View file

@ -327,7 +327,7 @@ class BuiltinOperators {
final IPointerType ptrType = (IPointerType) type; final IPointerType ptrType = (IPointerType) type;
if (SemanticUtil.getNestedType(ptrType.getType(), TDEF | CVTYPE) instanceof ICPPClassType) { if (SemanticUtil.getNestedType(ptrType.getType(), TDEF | CVTYPE) instanceof ICPPClassType) {
if (classPointers == null) { if (classPointers == null) {
classPointers= new ArrayList<IPointerType>(); classPointers= new ArrayList<>();
} }
classPointers.add(ptrType); classPointers.add(ptrType);
} }
@ -341,7 +341,7 @@ class BuiltinOperators {
type= SemanticUtil.getNestedType(type, TDEF | REF); type= SemanticUtil.getNestedType(type, TDEF | REF);
if (type instanceof ICPPPointerToMemberType) { if (type instanceof ICPPPointerToMemberType) {
if (memberPointers == null) { if (memberPointers == null) {
memberPointers= new ArrayList<ICPPPointerToMemberType>(); memberPointers= new ArrayList<>();
} }
memberPointers.add((ICPPPointerToMemberType) type); memberPointers.add((ICPPPointerToMemberType) type);
} }
@ -419,7 +419,7 @@ class BuiltinOperators {
} }
if (type != null) { if (type != null) {
if (p1 == null) { if (p1 == null) {
p1= new ArrayList<IType>(); p1= new ArrayList<>();
} }
p1.add(type); p1.add(type);
} }
@ -549,11 +549,11 @@ class BuiltinOperators {
ICPPFunctionType functionType = new CPPFunctionType(returnType, parameterTypes); ICPPFunctionType functionType = new CPPFunctionType(returnType, parameterTypes);
String sig= ASTTypeUtil.getType(functionType, true); String sig= ASTTypeUtil.getType(functionType, true);
if (fSignatures == null) { if (fSignatures == null) {
fSignatures= new HashSet<String>(); fSignatures= new HashSet<>();
if (fGlobalCandidates != null) { if (fGlobalCandidates != null) {
for (Object cand : fGlobalCandidates) { for (Object cand : fGlobalCandidates) {
if (cand instanceof IFunction && !(cand instanceof ICPPMethod)) { if (cand instanceof IFunction && !(cand instanceof ICPPMethod)) {
fSignatures.add(ASTTypeUtil.getType(((IFunction)cand).getType(), true)); fSignatures.add(ASTTypeUtil.getType(((IFunction) cand).getType(), true));
} }
} }
} }
@ -564,7 +564,7 @@ class BuiltinOperators {
parameter[i]= new CPPBuiltinParameter(t); parameter[i]= new CPPBuiltinParameter(t);
} }
if (fResult == null) { if (fResult == null) {
fResult= new ArrayList<ICPPFunction>(); fResult= new ArrayList<>();
} }
fResult.add(new CPPImplicitFunction(fOperator.toCharArray(), fFileScope, functionType, parameter, false)); fResult.add(new CPPImplicitFunction(fOperator.toCharArray(), fFileScope, functionType, parameter, false));
} }

View file

@ -2549,7 +2549,8 @@ public class CPPSemantics {
if (fn == null) if (fn == null)
continue; continue;
final FunctionCost fnCost= costForFunctionCall(fn, allowUDC, data); UDCMode udc = allowUDC ? UDCMode.DEFER : UDCMode.FORBIDDEN;
final FunctionCost fnCost= costForFunctionCall(fn, udc, data);
if (fnCost == null) if (fnCost == null)
continue; continue;
@ -2779,7 +2780,7 @@ public class CPPSemantics {
} }
} }
private static FunctionCost costForFunctionCall(ICPPFunction fn, boolean allowUDC, LookupData data) private static FunctionCost costForFunctionCall(ICPPFunction fn, UDCMode udc, LookupData data)
throws DOMException { throws DOMException {
IType[] argTypes= data.getFunctionArgumentTypes(); IType[] argTypes= data.getFunctionArgumentTypes();
ValueCategory[] argValueCategories= data.getFunctionArgumentValueCategories(); ValueCategory[] argValueCategories= data.getFunctionArgumentValueCategories();
@ -2854,7 +2855,6 @@ public class CPPSemantics {
result.setCost(k++, cost, impliedObjectValueCategory); result.setCost(k++, cost, impliedObjectValueCategory);
} }
final UDCMode udc = allowUDC ? UDCMode.DEFER : UDCMode.FORBIDDEN;
for (int j = 0; j < sourceLen; j++) { for (int j = 0; j < sourceLen; j++) {
final IType argType= SemanticUtil.getNestedType(argTypes[j + skipArg], TDEF | REF); final IType argType= SemanticUtil.getNestedType(argTypes[j + skipArg], TDEF | REF);
if (argType == null) if (argType == null)
@ -3683,8 +3683,7 @@ public class CPPSemantics {
} }
if (operator == OverloadableOperator.NEW || operator == OverloadableOperator.DELETE if (operator == OverloadableOperator.NEW || operator == OverloadableOperator.DELETE
|| operator == OverloadableOperator.NEW_ARRAY || operator == OverloadableOperator.DELETE_ARRAY) { || operator == OverloadableOperator.NEW_ARRAY || operator == OverloadableOperator.DELETE_ARRAY) {
// Those operators replace the built-in operator // Those operators replace the built-in operator
Object[] items= (Object[]) funcData.foundItems; Object[] items= (Object[]) funcData.foundItems;
int j= 0; int j= 0;