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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2009-04-12 05:48:15 +00:00
parent 3550a299d4
commit 824d47c599
3 changed files with 21 additions and 31 deletions

View file

@ -156,12 +156,10 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
}
}
public IASTNode[] getDeclarations() {
return declarations;
}
public IASTNode getDefinition() {
return definition;
}
@ -194,7 +192,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
}
}
}
private ICPPASTFunctionDeclarator extractFunctionDtor(IASTNode node) {
if (node instanceof IASTName)
node = node.getParent();
@ -211,7 +209,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
IASTStandardFunctionDeclarator dtor = getPreferredDtor();
IASTParameterDeclaration[] params = dtor.getParameters();
int size = params.length;
IParameter[] result = new IParameter[ size ];
IParameter[] result = new IParameter[size];
if (size > 0) {
for (int i = 0; i < size; i++) {
IASTParameterDeclaration p = params[i];
@ -229,7 +227,6 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return result;
}
public IScope getFunctionScope() {
resolveAllDeclarations();
if (definition != null) {
@ -239,12 +236,10 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return declarations[0].getFunctionScope();
}
public String getName() {
return getASTName().toString();
}
public char[] getNameCharArray() {
return getASTName().getSimpleID();
}
@ -255,7 +250,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
IASTName name= dtor.getName();
if (name instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
name = ns[ ns.length - 1 ];
name = ns[ns.length - 1];
}
return name;
}
@ -286,7 +281,6 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return scope;
}
public ICPPFunctionType getType() {
if (type == null)
type = (ICPPFunctionType) CPPVisitor.createType((definition != null) ? definition : declarations[0]);
@ -358,7 +352,6 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
}
}
public boolean isStatic() {
return isStatic(true);
}
@ -401,17 +394,14 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
// return false;
// }
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName(this);
}
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray(this);
}
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while (scope != null) {
@ -543,7 +533,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return IType.EMPTY_TYPE_ARRAY;
IType[] typeIds = new IType[astTypeIds.length];
for (int i=0; i<astTypeIds.length; ++i) {
for (int i= 0; i < astTypeIds.length; ++i) {
typeIds[i] = CPPVisitor.createType(astTypeIds[i]);
}
return typeIds;

View file

@ -52,6 +52,7 @@ import org.eclipse.core.runtime.CoreException;
*/
public class Conversions {
enum UDCMode {allowUDC, noUDC, deferUDC}
/**
* Computes the cost of an implicit conversion sequence
* [over.best.ics] 13.3.3.1
@ -201,7 +202,7 @@ public class Conversions {
return -1;
}
return cv1-cv2;
return cv1 - cv2;
}
/**
@ -338,10 +339,10 @@ public class Conversions {
return c;
}
//constructors
// Constructors
if (t instanceof ICPPClassType) {
ICPPConstructor[] ctors= ((ICPPClassType) t).getConstructors();
// select converting constructors
// Select converting constructors
int j= 0;
ICPPConstructor[] convertingCtors= new ICPPConstructor[ctors.length];
for (int i = 0; i < ctors.length; i++) {
@ -351,23 +352,23 @@ public class Conversions {
}
if (j > 0) {
LookupData data= new LookupData();
data.setFunctionArgumentTypes(new IType [] { source });
data.setFunctionArgumentTypes(new IType[] { source });
IBinding binding = CPPSemantics.resolveFunction(data, convertingCtors, false);
if (binding instanceof ICPPConstructor && !(binding instanceof IProblemBinding)) {
constructorCost = checkStandardConversionSequence(t, target, false);
if (constructorCost.getRank() == Rank.NO_MATCH) {
constructorCost= null;
} else {
constructorCost.setUserDefinedConversion((ICPPConstructor)binding);
constructorCost.setUserDefinedConversion((ICPPConstructor) binding);
}
}
}
}
//conversion operators
// Conversion operators
boolean ambiguousConversionOperator= false;
if (s instanceof ICPPClassType) {
ICPPMethod [] ops = SemanticUtil.getConversionOperators((ICPPClassType) s);
ICPPMethod[] ops = SemanticUtil.getConversionOperators((ICPPClassType) s);
if (ops.length > 0 && !(ops[0] instanceof IProblemBinding)) {
for (final ICPPMethod op : ops) {
Cost cost= checkStandardConversionSequence(op.getType().getReturnType(), target, false);
@ -455,7 +456,6 @@ public class Conversions {
boolean isConverted= false;
IType target = getNestedType(cost.target, REF | TDEF);
IType source= getNestedType(cost.source, TDEF);
// 4.1 lvalue to rvalue
IType srcRValue= getNestedType(source, REF | TDEF);
@ -524,7 +524,7 @@ public class Conversions {
}
}
// this should actually be done in 'checkImplicitConversionSequence', see 13.3.3.1-6 and 8.5.14
// This should actually be done in 'checkImplicitConversionSequence', see 13.3.3.1-6 and 8.5.14
// 8.5.14 cv-qualifiers can be ignored for non-class types
IType unqualifiedTarget= getNestedType(target, CVQ | PTR_CVQ | TDEF | REF);
if (!(unqualifiedTarget instanceof ICPPClassType)) {
@ -788,8 +788,8 @@ public class Conversions {
if (type instanceof IIndexFragmentBinding) {
try {
return ((IIndexFragmentBinding) type).hasDefinition();
} catch(CoreException ce) {
CCorePlugin.log(ce);
} catch (CoreException e) {
CCorePlugin.log(e);
}
}
try {

View file

@ -87,9 +87,9 @@ class FunctionCost {
// In order for this function to be better than the previous best, it must
// have at least one parameter match that is better that the corresponding
// match for the other function, and none that are worse.
int idx= getLength()-1;
int idxOther= other.getLength()-1;
for (; idx>=0 && idxOther>=0; idx--,idxOther--) {
int idx= getLength() - 1;
int idxOther= other.getLength() - 1;
for (; idx >= 0 && idxOther >= 0; idx--, idxOther--) {
Cost cost= getCost(idx);
if (cost.getRank() == Rank.NO_MATCH) {
haveWorse = true;
@ -140,9 +140,9 @@ class FunctionCost {
return false;
boolean haveWorse= false;
int idx= getLength()-1;
int idxOther= other.getLength()-1;
for (; idx>=0 && idxOther>=0; idx--,idxOther--) {
int idx= getLength() - 1;
int idxOther= other.getLength() - 1;
for (; idx >= 0 && idxOther >= 0; idx--, idxOther--) {
Cost cost= getCost(idx);
if (cost.getRank() == Rank.NO_MATCH)
return true;