1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-11-27 18:36:07 -08:00
parent 234f14db57
commit cfe498ae3b
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 final ICPPAliasTemplate aliasTemplate;
private IType aliasedType; private IType aliasedType;
public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) { public CPPAliasTemplateInstance(char[] name, ICPPAliasTemplate aliasTemplate, IType aliasedType) {
this.name = name; this.name = name;
this.aliasTemplate = aliasTemplate; this.aliasTemplate = aliasTemplate;
this.aliasedType = aliasedType; this.aliasedType = aliasedType;
@ -122,7 +122,7 @@ public class CPPAliasTemplateInstance extends PlatformObject
char[] name = buffer.getCharArray(); char[] name = buffer.getCharArray();
IType unmarshalledAliasedTypeInstance = buffer.unmarshalType(); IType unmarshalledAliasedTypeInstance = buffer.unmarshalType();
ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding(); ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding();
return new CPPAliasTemplateInstance(name, unmarshalledAliasedTypeInstance, unmarshalledAlias); return new CPPAliasTemplateInstance(name, unmarshalledAlias, unmarshalledAliasedTypeInstance);
} }
@Override @Override

View file

@ -28,7 +28,8 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
private IType fType; 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); super(specialized, owner, tpmap);
fType= type; fType= type;
} }
@ -38,23 +39,17 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
return fType; return fType;
} }
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override @Override
public Object clone() { public Object clone() {
IType t = null; IType t = null;
try { try {
t = (IType) super.clone(); t = (IType) super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// not going to happen // Not going to happen.
} }
return t; return t;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
@Override @Override
public boolean isSameType(IType o) { public boolean isSameType(IType o) {
if (o == this) if (o == this)

View file

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

View file

@ -659,7 +659,7 @@ public class CPPTemplates {
IBinding owner = template.getOwner(); IBinding owner = template.getOwner();
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id); IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id);
return new CPPAliasTemplateInstance(id.toCharArray(), instantiatedType, aliasTemplate); return new CPPAliasTemplateInstance(id.toCharArray(), aliasTemplate, instantiatedType);
} }
// Class template. // Class template.
@ -830,7 +830,7 @@ public class CPPTemplates {
} else if (decl instanceof ICPPAliasTemplate) { } else if (decl instanceof ICPPAliasTemplate) {
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl; ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point); 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) { } else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter. // TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
spec = decl; 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.IASTBinaryTypeIdExpression.Operator;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory; import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IASTNode; 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.IType;
import org.eclipse.cdt.core.dom.ast.IValue; import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
@ -73,7 +72,7 @@ public class EvalBinaryTypeId extends CPPEvaluation {
case __is_base_of: case __is_base_of:
return CPPBasicType.BOOLEAN; return CPPBasicType.BOOLEAN;
} }
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); return ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
@Override @Override

View file

@ -174,7 +174,7 @@ public class EvalConditional extends CPPEvaluation {
} else if (void2 && void3) { } else if (void2 && void3) {
fType= uqt2; fType= uqt2;
} else { } else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
return; return;
} }
@ -204,10 +204,10 @@ public class EvalConditional extends CPPEvaluation {
if (cost2.converts() || cost3.converts()) { if (cost2.converts() || cost3.converts()) {
if (cost2.converts()) { if (cost2.converts()) {
if (cost3.converts() || cost2.isAmbiguousUDC()) { if (cost3.converts() || cost2.isAmbiguousUDC()) {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
} else if (cost3.isAmbiguousUDC()) { } else if (cost3.isAmbiguousUDC()) {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
return; return;
} }
@ -222,7 +222,7 @@ public class EvalConditional extends CPPEvaluation {
fType= t3; fType= t3;
fValueCategory= vcat3; fValueCategory= vcat3;
} else { } else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
return; return;
} }
@ -233,7 +233,7 @@ public class EvalConditional extends CPPEvaluation {
if (fOverload != null) { if (fOverload != null) {
fType= ExpressionTypes.typeFromFunctionCall(fOverload); fType= ExpressionTypes.typeFromFunctionCall(fOverload);
} else { } else {
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
return; return;
} }
@ -248,7 +248,7 @@ public class EvalConditional extends CPPEvaluation {
if (fType == null) { if (fType == null) {
fType= Conversions.compositePointerType(t2, t3); fType= Conversions.compositePointerType(t2, t3);
if (fType == null) { 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IFunctionType; import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IPointerType; 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.IType;
import org.eclipse.cdt.core.dom.ast.IValue; import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
@ -123,7 +122,7 @@ public class EvalFunctionCall extends CPPEvaluation {
final ICPPEvaluation arg0 = fArguments[0]; final ICPPEvaluation arg0 = fArguments[0];
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE); IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
if (t instanceof ICPPClassType) { if (t instanceof ICPPClassType) {
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); return ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
if (t instanceof IPointerType) { if (t instanceof IPointerType) {
@ -136,7 +135,7 @@ public class EvalFunctionCall extends CPPEvaluation {
} }
return t; return t;
} }
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); return ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
@Override @Override
@ -151,7 +150,6 @@ public class EvalFunctionCall extends CPPEvaluation {
if (overload != null) if (overload != null)
return valueCategoryFromFunctionCall(overload); return valueCategoryFromFunctionCall(overload);
IType t= fArguments[0].getTypeOrFunctionSet(point); IType t= fArguments[0].getTypeOrFunctionSet(point);
if (t instanceof IPointerType) { if (t instanceof IPointerType) {
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE); 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.IFunction;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IScope; 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.IType;
import org.eclipse.cdt.core.dom.ast.IValue; import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.IVariable;
@ -196,7 +195,7 @@ public class EvalMemberAccess extends CPPEvaluation {
if (CPPTemplates.isDependentType(type)) if (CPPTemplates.isDependentType(type))
return returnUnnamed ? CPPUnknownMemberClass.createUnnamedInstance() : null; return returnUnnamed ? CPPUnknownMemberClass.createUnnamedInstance() : null;
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); return ProblemType.UNKNOWN_FOR_EXPRESSION;
} }
@Override @Override

View file

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