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-27 18:36:07 -08:00
parent f6b4b3dae2
commit 67a81b6a4b
10 changed files with 63 additions and 71 deletions

View file

@ -35,7 +35,7 @@ public class CPPAliasTemplateInstance extends PlatformObject
private final ICPPAliasTemplate aliasTemplate;
private IType aliasedType;
public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) {
public CPPAliasTemplateInstance(char[] name, ICPPAliasTemplate aliasTemplate, IType aliasedType) {
this.name = name;
this.aliasTemplate = aliasTemplate;
this.aliasedType = aliasedType;
@ -122,7 +122,7 @@ public class CPPAliasTemplateInstance extends PlatformObject
char[] name = buffer.getCharArray();
IType unmarshalledAliasedTypeInstance = buffer.unmarshalType();
ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding();
return new CPPAliasTemplateInstance(name, unmarshalledAliasedTypeInstance, unmarshalledAlias);
return new CPPAliasTemplateInstance(name, unmarshalledAlias, unmarshalledAliasedTypeInstance);
}
@Override

View file

@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
* Copyright (c) 2004, 2010 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Contributors:
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
@ -28,7 +28,8 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
private IType fType;
public CPPTypedefSpecialization(IBinding specialized, ICPPClassType owner, ICPPTemplateParameterMap tpmap, IType type) {
public CPPTypedefSpecialization(IBinding specialized, ICPPClassType owner,
ICPPTemplateParameterMap tpmap, IType type) {
super(specialized, owner, tpmap);
fType= type;
}
@ -38,23 +39,17 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
return fType;
}
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
IType t = null;
try {
t = (IType) super.clone();
} catch (CloneNotSupportedException e) {
// not going to happen
// Not going to happen.
}
return t;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
@Override
public boolean isSameType(IType o) {
if (o == this)

View file

@ -33,6 +33,7 @@ public class CPPUnknownMemberClass extends CPPUnknownMember implements ICPPUnkno
public static CPPUnknownMemberClass createUnnamedInstance() {
return new CPPUnknownMemberClass(null, CharArrayUtils.EMPTY);
}
public CPPUnknownMemberClass(IType owner, char[] name) {
super(owner, name);
}

View file

@ -659,7 +659,7 @@ public class CPPTemplates {
IBinding owner = template.getOwner();
ICPPClassSpecialization within = getSpecializationContext(owner);
IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id);
return new CPPAliasTemplateInstance(id.toCharArray(), instantiatedType, aliasTemplate);
return new CPPAliasTemplateInstance(id.toCharArray(), aliasTemplate, instantiatedType);
}
// Class template.
@ -830,7 +830,7 @@ public class CPPTemplates {
} else if (decl instanceof ICPPAliasTemplate) {
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), type, aliasTemplate);
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
spec = decl;

View file

@ -16,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression.Operator;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
@ -73,7 +72,7 @@ public class EvalBinaryTypeId extends CPPEvaluation {
case __is_base_of:
return CPPBasicType.BOOLEAN;
}
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@Override

View file

@ -174,7 +174,7 @@ public class EvalConditional extends CPPEvaluation {
} else if (void2 && void3) {
fType= uqt2;
} else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
return;
}
@ -204,10 +204,10 @@ public class EvalConditional extends CPPEvaluation {
if (cost2.converts() || cost3.converts()) {
if (cost2.converts()) {
if (cost3.converts() || cost2.isAmbiguousUDC()) {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
} else if (cost3.isAmbiguousUDC()) {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
return;
}
@ -222,7 +222,7 @@ public class EvalConditional extends CPPEvaluation {
fType= t3;
fValueCategory= vcat3;
} else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
return;
}
@ -233,7 +233,7 @@ public class EvalConditional extends CPPEvaluation {
if (fOverload != null) {
fType= ExpressionTypes.typeFromFunctionCall(fOverload);
} else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
return;
}
@ -248,7 +248,7 @@ public class EvalConditional extends CPPEvaluation {
if (fType == null) {
fType= Conversions.compositePointerType(t2, t3);
if (fType == null) {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
}
}

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
@ -123,7 +122,7 @@ public class EvalFunctionCall extends CPPEvaluation {
final ICPPEvaluation arg0 = fArguments[0];
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
if (t instanceof ICPPClassType) {
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
if (t instanceof IPointerType) {
@ -136,7 +135,7 @@ public class EvalFunctionCall extends CPPEvaluation {
}
return t;
}
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@Override
@ -151,7 +150,6 @@ public class EvalFunctionCall extends CPPEvaluation {
if (overload != null)
return valueCategoryFromFunctionCall(overload);
IType t= fArguments[0].getTypeOrFunctionSet(point);
if (t instanceof IPointerType) {
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);

View file

@ -32,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.IVariable;
@ -196,7 +195,7 @@ public class EvalMemberAccess extends CPPEvaluation {
if (CPPTemplates.isDependentType(type))
return returnUnnamed ? CPPUnknownMemberClass.createUnnamedInstance() : null;
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@Override

View file

@ -108,7 +108,7 @@ public class EvalUnary extends CPPEvaluation {
if (fType != null)
return fType instanceof TypeOfDependentExpression;
switch(fOperator) {
switch (fOperator) {
case op_alignOf:
case op_not:
case op_sizeof:
@ -217,7 +217,7 @@ public class EvalUnary extends CPPEvaluation {
if (type instanceof ISemanticProblem) {
return type;
}
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
return ProblemType.UNKNOWN_FOR_EXPRESSION;
case op_noexcept:
case op_not:
return CPPBasicType.BOOLEAN;