mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
a2f501987d
commit
c67276494e
7 changed files with 1119 additions and 1108 deletions
File diff suppressed because it is too large
Load diff
|
@ -7038,7 +7038,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// newArray var5;
|
// newArray var5;
|
||||||
//
|
//
|
||||||
// void foo() {
|
// 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
|
// * each of the following statements
|
||||||
// */
|
// */
|
||||||
// var1[1].a = 1;
|
// var1[1].a = 1;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
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;
|
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;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
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
|
* <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.
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
if (CPPTemplates.isDependentType(t))
|
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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM) - Initial API and implementation
|
* Andrew Niefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
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.
|
* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||||
if( f != null )
|
if (f != null)
|
||||||
return f.isVirtual();
|
return f.isVirtual();
|
||||||
IASTNode definition = getDefinition();
|
IASTNode definition = getDefinition();
|
||||||
if( definition != null ){
|
if (definition != null) {
|
||||||
IASTNode node = definition.getParent();
|
IASTNode node = definition.getParent();
|
||||||
while( node instanceof IASTDeclarator )
|
while(node instanceof IASTDeclarator)
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
||||||
@Override
|
@Override
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||||
if( f != null )
|
if (f != null)
|
||||||
return f.getVisibility();
|
return f.getVisibility();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,13 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExplicit() {
|
public boolean isExplicit() {
|
||||||
return ((ICPPMethod)getSpecializedBinding()).isExplicit();
|
return ((ICPPMethod) getSpecializedBinding()).isExplicit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue