1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 313817 Fixed f.p. when assignment is overloaded operator

This commit is contained in:
Alena Laskavaia 2010-05-21 03:37:16 +00:00
parent 5df1f3e42d
commit d87f6ff74c

View file

@ -127,6 +127,7 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
addPreference(problem, PARAM_MACRO_ID,
CheckersMessages.StatementHasNoEffectChecker_ParameterMacro,
Boolean.TRUE);
}
/**
@ -139,19 +140,7 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
@SuppressWarnings("restriction")
public boolean isLValue(IASTBinaryExpression expr) {
if (expr instanceof CPPASTBinaryExpression) {
// unfortunately ICPPASTBinaryExpression does not have
// getOverload public method
CPPASTBinaryExpression cppBin = (CPPASTBinaryExpression) expr;
ICPPFunction overload = cppBin.getOverload();
if (overload != null)
return false;
IType expressionType = cppBin.getOperand1().getExpressionType();
if (!(expressionType instanceof IBasicType)) {
return false; // must be overloaded but parser could not
// find it
}
}
switch (expr.getOperator()) {
case IASTBinaryExpression.op_assign:
case IASTBinaryExpression.op_binaryAndAssign:
@ -166,6 +155,19 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
case IASTBinaryExpression.op_shiftRightAssign:
return true;
}
if (expr instanceof CPPASTBinaryExpression) {
// unfortunately ICPPASTBinaryExpression does not have
// getOverload public method
CPPASTBinaryExpression cppBin = (CPPASTBinaryExpression) expr;
ICPPFunction overload = cppBin.getOverload();
if (overload != null)
return true;
IType expressionType = cppBin.getOperand1().getExpressionType();
if (!(expressionType instanceof IBasicType)) {
return true; // must be overloaded but parser could not
// find it
}
}
return false;
}
}