diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java index 148d97d9fcc..8c66e80b832 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java @@ -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.cpp.ICPPASTInitializerClause; 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.ICPPTemplateDefinition; 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. public static final Value ERROR= 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() { @Override @@ -300,7 +298,7 @@ public class Value implements IValue { return create(val.longValue() + increment); } 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())); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java index 09daa2726f2..1ca94000b91 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java @@ -327,7 +327,7 @@ class BuiltinOperators { final IPointerType ptrType = (IPointerType) type; if (SemanticUtil.getNestedType(ptrType.getType(), TDEF | CVTYPE) instanceof ICPPClassType) { if (classPointers == null) { - classPointers= new ArrayList(); + classPointers= new ArrayList<>(); } classPointers.add(ptrType); } @@ -341,7 +341,7 @@ class BuiltinOperators { type= SemanticUtil.getNestedType(type, TDEF | REF); if (type instanceof ICPPPointerToMemberType) { if (memberPointers == null) { - memberPointers= new ArrayList(); + memberPointers= new ArrayList<>(); } memberPointers.add((ICPPPointerToMemberType) type); } @@ -419,7 +419,7 @@ class BuiltinOperators { } if (type != null) { if (p1 == null) { - p1= new ArrayList(); + p1= new ArrayList<>(); } p1.add(type); } @@ -549,11 +549,11 @@ class BuiltinOperators { ICPPFunctionType functionType = new CPPFunctionType(returnType, parameterTypes); String sig= ASTTypeUtil.getType(functionType, true); if (fSignatures == null) { - fSignatures= new HashSet(); + fSignatures= new HashSet<>(); if (fGlobalCandidates != null) { for (Object cand : fGlobalCandidates) { 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); } if (fResult == null) { - fResult= new ArrayList(); + fResult= new ArrayList<>(); } fResult.add(new CPPImplicitFunction(fOperator.toCharArray(), fFileScope, functionType, parameter, false)); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java index 2a48a406e6a..8fe52e0fd9e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java @@ -2549,7 +2549,8 @@ public class CPPSemantics { if (fn == null) 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) 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 { IType[] argTypes= data.getFunctionArgumentTypes(); ValueCategory[] argValueCategories= data.getFunctionArgumentValueCategories(); @@ -2854,7 +2855,6 @@ public class CPPSemantics { result.setCost(k++, cost, impliedObjectValueCategory); } - final UDCMode udc = allowUDC ? UDCMode.DEFER : UDCMode.FORBIDDEN; for (int j = 0; j < sourceLen; j++) { final IType argType= SemanticUtil.getNestedType(argTypes[j + skipArg], TDEF | REF); if (argType == null) @@ -3683,8 +3683,7 @@ public class CPPSemantics { } 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 Object[] items= (Object[]) funcData.foundItems; int j= 0;