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 a2f501987d
commit c67276494e
7 changed files with 1119 additions and 1108 deletions

View file

@ -7038,7 +7038,7 @@ public class AST2Tests extends AST2BaseTest {
// newArray var5;
//
// void foo() {
// /* The type of the arraysubscript expression should be struct s
// /* The type of the array subscript expression should be struct s
// * each of the following statements
// */
// var1[1].a = 1;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext;
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
private ASTAccessVisibility fVisibility;
private String fTypeName;
private boolean fIsStatic;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM Rational Software) - Initial API and implementation
* John Camelon (IBM Rational Software) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
@ -142,7 +142,8 @@ public interface IASTUnaryExpression extends IASTExpression {
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
* 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.

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.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.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.REF;
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.IType;
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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
@ -260,15 +262,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public IType getExpressionType() {
// Handle explicit type conversion in functional notation.
IType t= isExplicitTypeConversion();
if (t != null) {
if (t instanceof IProblemBinding) {
IType type= isExplicitTypeConversion();
if (type != null) {
if (type instanceof IProblemBinding) {
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 (overload == UNINITIALIZED_FUNCTION) {
overload = CPPSemantics.findOverloadedOperator(this, (ICPPClassType) t);
@ -283,9 +286,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
}
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;
}
return type;
}
if (CPPTemplates.isDependentType(t))
if (CPPTemplates.isDependentType(type))
return CPPUnknownClass.createUnnamedInstance();
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);
}
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap, ICPPClassSpecialization context) {
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap,
ICPPClassSpecialization context) {
super(orig, owner, argMap);
fContext= context;
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -24,31 +24,31 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
/**
* The specialization of a method in the context of a class-specialization.
*/
public class CPPMethodSpecialization extends CPPFunctionSpecialization
implements ICPPMethod {
public class CPPMethodSpecialization extends CPPFunctionSpecialization implements ICPPMethod {
public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap ) {
super(orig, owner, argMap );
public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap) {
super(orig, owner, argMap);
}
@Override
public boolean isVirtual() {
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if( f != null )
if (f != null)
return f.isVirtual();
IASTNode definition = getDefinition();
if( definition != null ){
if (definition != null) {
IASTNode node = definition.getParent();
while( node instanceof IASTDeclarator )
while(node instanceof IASTDeclarator)
node = node.getParent();
ICPPASTDeclSpecifier declSpec = null;
if( node instanceof IASTSimpleDeclaration )
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)node).getDeclSpecifier();
else if( node instanceof IASTFunctionDefinition )
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)node).getDeclSpecifier();
if (node instanceof IASTSimpleDeclaration) {
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) node).getDeclSpecifier();
} else if (node instanceof IASTFunctionDefinition) {
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) node).getDeclSpecifier();
}
if( declSpec != null ){
if (declSpec != null) {
return declSpec.isVirtual();
}
}
@ -58,7 +58,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
@Override
public int getVisibility() {
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if( f != null )
if (f != null)
return f.getVisibility();
return 0;
}
@ -73,13 +73,13 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;
return false;
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)getSpecializedBinding()).isExplicit();
return ((ICPPMethod) getSpecializedBinding()).isExplicit();
}
@Override