mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
Cosmetics.
This commit is contained in:
parent
a562b0332e
commit
ec30f112e9
1 changed files with 20 additions and 11 deletions
|
@ -66,7 +66,8 @@ public class Conversions {
|
||||||
* @return the cost of converting from source to target
|
* @return the cost of converting from source to target
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
public static Cost checkImplicitConversionSequence(boolean allowUDC, IASTExpression sourceExp, IType source, IType target, boolean isImpliedObject) throws DOMException {
|
public static Cost checkImplicitConversionSequence(boolean allowUDC, IASTExpression sourceExp,
|
||||||
|
IType source, IType target, boolean isImpliedObject) throws DOMException {
|
||||||
Cost cost;
|
Cost cost;
|
||||||
|
|
||||||
allowUDC &= !isImpliedObject;
|
allowUDC &= !isImpliedObject;
|
||||||
|
@ -80,7 +81,8 @@ public class Conversions {
|
||||||
cost.targetHadReference= true;
|
cost.targetHadReference= true;
|
||||||
|
|
||||||
boolean lvalue= sourceExp == null || !CPPVisitor.isRValue(sourceExp);
|
boolean lvalue= sourceExp == null || !CPPVisitor.isRValue(sourceExp);
|
||||||
IType T2= source instanceof IQualifierType ? getUltimateTypeViaTypedefs(((IQualifierType) source).getType()) : source;
|
IType T2= source instanceof IQualifierType ?
|
||||||
|
getUltimateTypeViaTypedefs(((IQualifierType) source).getType()) : source;
|
||||||
|
|
||||||
if (lvalue && isReferenceCompatible(cv1T1, source)) {
|
if (lvalue && isReferenceCompatible(cv1T1, source)) {
|
||||||
// Direct reference binding
|
// Direct reference binding
|
||||||
|
@ -88,7 +90,8 @@ public class Conversions {
|
||||||
if (cost.source.isSameType(cost.target) ||
|
if (cost.source.isSameType(cost.target) ||
|
||||||
// 7.3.3.13 for overload resolution the implicit this pointer is treated as if
|
// 7.3.3.13 for overload resolution the implicit this pointer is treated as if
|
||||||
// it were a pointer to the derived class
|
// it were a pointer to the derived class
|
||||||
(isImpliedObject && cost.source instanceof ICPPClassType && cost.target instanceof ICPPClassType)) {
|
(isImpliedObject && cost.source instanceof ICPPClassType &&
|
||||||
|
cost.target instanceof ICPPClassType)) {
|
||||||
cost.rank = Cost.IDENTITY_RANK;
|
cost.rank = Cost.IDENTITY_RANK;
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +114,8 @@ public class Conversions {
|
||||||
boolean ambiguousConversionOperator= false;
|
boolean ambiguousConversionOperator= false;
|
||||||
if (fcns.length > 0 && !(fcns[0] instanceof IProblemBinding)) {
|
if (fcns.length > 0 && !(fcns[0] instanceof IProblemBinding)) {
|
||||||
for (final ICPPMethod op : fcns) {
|
for (final ICPPMethod op : fcns) {
|
||||||
Cost cost2 = checkStandardConversionSequence(op.getType().getReturnType(), target, false);
|
Cost cost2 = checkStandardConversionSequence(op.getType().getReturnType(), target,
|
||||||
|
false);
|
||||||
if (cost2.rank != Cost.NO_MATCH_RANK) {
|
if (cost2.rank != Cost.NO_MATCH_RANK) {
|
||||||
if (operatorCost == null) {
|
if (operatorCost == null) {
|
||||||
operatorCost= cost2;
|
operatorCost= cost2;
|
||||||
|
@ -157,11 +161,13 @@ public class Conversions {
|
||||||
cost.rank= Cost.IDENTITY_RANK;
|
cost.rank= Cost.IDENTITY_RANK;
|
||||||
} else {
|
} else {
|
||||||
// 5 - Otherwise
|
// 5 - Otherwise
|
||||||
// Otherwise, a temporary of type "cv1 T1" is created and initialized from the initializer expression
|
// Otherwise, a temporary of type "cv1 T1" is created and initialized from
|
||||||
// using the rules for a non-reference copy initialization (8.5). The reference is then bound to the temporary.
|
// the initializer expression using the rules for a non-reference copy
|
||||||
|
// initialization (8.5). The reference is then bound to the temporary.
|
||||||
|
|
||||||
// If T1 is reference-related to T2, cv1 must be the same cv-qualification as, or greater cvqualification
|
// If T1 is reference-related to T2, cv1 must be the same cv-qualification as,
|
||||||
// than, cv2; otherwise, the program is ill-formed. [Example
|
// or greater cv-qualification than, cv2; otherwise, the program is ill-formed.
|
||||||
|
// [Example
|
||||||
boolean illformed= false;
|
boolean illformed= false;
|
||||||
if (isReferenceRelated(cv1T1, source)) {
|
if (isReferenceRelated(cv1T1, source)) {
|
||||||
Integer cmp= compareQualifications(cv1T1, source);
|
Integer cmp= compareQualifications(cv1T1, source);
|
||||||
|
@ -250,7 +256,8 @@ public class Conversions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [8.5.3] "cv1 T1" is reference-related to "cv2 T2" if T1 is the same type as T2, or T1 is a base class of T2.
|
* [8.5.3] "cv1 T1" is reference-related to "cv2 T2" if T1 is the same type as T2,
|
||||||
|
* or T1 is a base class of T2.
|
||||||
* Note this is not a symmetric relation.
|
* Note this is not a symmetric relation.
|
||||||
* @param cv1t1
|
* @param cv1t1
|
||||||
* @param cv2t2
|
* @param cv2t2
|
||||||
|
@ -305,7 +312,8 @@ public class Conversions {
|
||||||
* base conversion does not cause any costs.
|
* base conversion does not cause any costs.
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
protected static final Cost checkStandardConversionSequence(IType source, IType target, boolean isImplicitThis) throws DOMException {
|
protected static final Cost checkStandardConversionSequence(IType source, IType target,
|
||||||
|
boolean isImplicitThis) throws DOMException {
|
||||||
Cost cost = lvalue_to_rvalue(source, target);
|
Cost cost = lvalue_to_rvalue(source, target);
|
||||||
|
|
||||||
if (cost.source == null || cost.target == null) {
|
if (cost.source == null || cost.target == null) {
|
||||||
|
@ -449,7 +457,8 @@ public class Conversions {
|
||||||
* no inheritance relation
|
* no inheritance relation
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
private static final int calculateInheritanceDepth(int maxdepth, IType type, IType ancestorToFind) throws DOMException {
|
private static final int calculateInheritanceDepth(int maxdepth, IType type, IType ancestorToFind)
|
||||||
|
throws DOMException {
|
||||||
if (type == ancestorToFind || type.isSameType(ancestorToFind)) {
|
if (type == ancestorToFind || type.isSameType(ancestorToFind)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue