mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 390782 - NPE in AssignmentToItselfChecker$1.isAssignmentToItself
This commit is contained in:
parent
3e0f5e9e44
commit
af5a14ac6d
1 changed files with 13 additions and 9 deletions
|
@ -41,16 +41,20 @@ public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAssignmentToItself(IASTExpression e) {
|
private boolean isAssignmentToItself(IASTExpression expr) {
|
||||||
if (e instanceof IASTBinaryExpression) {
|
if (expr instanceof IASTBinaryExpression) {
|
||||||
IASTBinaryExpression binExpr = (IASTBinaryExpression) e;
|
IASTBinaryExpression binExpr = (IASTBinaryExpression) expr;
|
||||||
if (binExpr.getOperator() == IASTBinaryExpression.op_assign) {
|
if (binExpr.getOperator() == IASTBinaryExpression.op_assign) {
|
||||||
String op1 = binExpr.getOperand1().getRawSignature();
|
IASTExpression operand1 = binExpr.getOperand1();
|
||||||
String op2 = binExpr.getOperand2().getRawSignature();
|
IASTExpression operand2 = binExpr.getOperand2();
|
||||||
String expr = binExpr.getRawSignature();
|
if (operand1 != null && operand2 != null) {
|
||||||
return op1.equals(op2)
|
String op1 = operand1.getRawSignature();
|
||||||
// When macro is used, RawSignature returns macro name, see bug 321933
|
String op2 = operand2.getRawSignature();
|
||||||
&& !op1.equals(expr);
|
String exprImage = binExpr.getRawSignature();
|
||||||
|
return op1.equals(op2)
|
||||||
|
// When macro is used, RawSignature returns macro name, see bug 321933
|
||||||
|
&& !op1.equals(exprImage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue