Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2010-05-20 23:37:16 -0400
committerAlena Laskavaia2010-05-20 23:37:16 -0400
commitd87f6ff74ca1d0f3fb9fb9e87c39ac7511afb753 (patch)
tree1029122765572b62c3fec1f4aa7c48c0fffacd0b /codan
parent5df1f3e42de8f55fd615a4670f2e788498c45c24 (diff)
downloadorg.eclipse.cdt-d87f6ff74ca1d0f3fb9fb9e87c39ac7511afb753.tar.gz
org.eclipse.cdt-d87f6ff74ca1d0f3fb9fb9e87c39ac7511afb753.tar.xz
org.eclipse.cdt-d87f6ff74ca1d0f3fb9fb9e87c39ac7511afb753.zip
Bug 313817 Fixed f.p. when assignment is overloaded operator
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
index 4b4a614967..11f5f9370b 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
@@ -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;
}
}

Back to the top