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-06-05 10:31:26 -07:00
parent 502215b286
commit 077c4ed4a1
7 changed files with 1119 additions and 1108 deletions

View file

@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField { public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
private ASTAccessVisibility fVisibility; private ASTAccessVisibility fVisibility;
private String fTypeName; private String fTypeName;
private boolean fIsStatic; private boolean fIsStatic;

View file

@ -142,7 +142,8 @@ public interface IASTUnaryExpression extends IASTExpression {
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and * <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
* it's nested <code>IASTExpression</code>. * it's nested <code>IASTExpression</code>.
*/ */
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$ public static final ASTNodeProperty OPERAND =
new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$
/** /**
* Get the operand. * Get the operand.

View file

@ -19,6 +19,7 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionT
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromFunctionCall; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromFunctionCall;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromReturnType; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromReturnType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.COND_TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
@ -40,6 +41,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem; 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.cpp.ICPPASTExpressionList; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
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.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
@ -260,15 +262,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override @Override
public IType getExpressionType() { public IType getExpressionType() {
// Handle explicit type conversion in functional notation. // Handle explicit type conversion in functional notation.
IType t= isExplicitTypeConversion(); IType type= isExplicitTypeConversion();
if (t != null) { if (type != null) {
if (t instanceof IProblemBinding) { if (type instanceof IProblemBinding) {
return ProblemType.UNRESOLVED_NAME; return ProblemType.UNRESOLVED_NAME;
} }
return prvalueType(t); return prvalueType(type);
} }
t= SemanticUtil.getNestedType(functionName.getExpressionType(), TDEF | REF | CVTYPE); type= SemanticUtil.getNestedType(functionName.getExpressionType(), COND_TDEF | REF | CVTYPE);
IType t = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (t instanceof ICPPClassType) { if (t instanceof ICPPClassType) {
if (overload == UNINITIALIZED_FUNCTION) { if (overload == UNINITIALIZED_FUNCTION) {
overload = CPPSemantics.findOverloadedOperator(this, (ICPPClassType) t); overload = CPPSemantics.findOverloadedOperator(this, (ICPPClassType) t);
@ -283,9 +286,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE); t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
} }
if (t instanceof IFunctionType) { if (t instanceof IFunctionType) {
return typeFromReturnType(((IFunctionType) t).getReturnType()); type = typeFromReturnType(((IFunctionType) t).getReturnType());
if (functionName instanceof ICPPASTFieldReference) {
IType ownerType = ((ICPPASTFieldReference) functionName).getFieldOwnerType();
t = SemanticUtil.substituteTypedef(type, ownerType);
if (t != null)
type = t;
} }
if (CPPTemplates.isDependentType(t)) return type;
}
if (CPPTemplates.isDependentType(type))
return CPPUnknownClass.createUnnamedInstance(); return CPPUnknownClass.createUnnamedInstance();
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION); return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);

View file

@ -50,7 +50,8 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
this(orig, owner, argMap, null); this(orig, owner, argMap, null);
} }
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap, ICPPClassSpecialization context) { public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap,
ICPPClassSpecialization context) {
super(orig, owner, argMap); super(orig, owner, argMap);
fContext= context; fContext= context;
} }

View file

@ -24,8 +24,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
/** /**
* The specialization of a method in the context of a class-specialization. * The specialization of a method in the context of a class-specialization.
*/ */
public class CPPMethodSpecialization extends CPPFunctionSpecialization public class CPPMethodSpecialization extends CPPFunctionSpecialization implements ICPPMethod {
implements ICPPMethod {
public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap) { public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap) {
super(orig, owner, argMap); super(orig, owner, argMap);
@ -43,10 +42,11 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
node = node.getParent(); node = node.getParent();
ICPPASTDeclSpecifier declSpec = null; ICPPASTDeclSpecifier declSpec = null;
if( node instanceof IASTSimpleDeclaration ) if (node instanceof IASTSimpleDeclaration) {
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) node).getDeclSpecifier(); declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) node).getDeclSpecifier();
else if( node instanceof IASTFunctionDefinition ) } else if (node instanceof IASTFunctionDefinition) {
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) node).getDeclSpecifier(); declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) node).getDeclSpecifier();
}
if (declSpec != null) { if (declSpec != null) {
return declSpec.isVirtual(); return declSpec.isVirtual();