use of soot.jimple.internal.JEqExpr in project soot by Sable.
the class NullnessAnalysis method handleEqualityOrNonEqualityCheck.
private void handleEqualityOrNonEqualityCheck(AbstractBinopExpr eqExpr, AnalysisInfo in, AnalysisInfo out, AnalysisInfo outBranch) {
Value left = eqExpr.getOp1();
Value right = eqExpr.getOp2();
Value val = null;
if (left == NullConstant.v()) {
if (right != NullConstant.v()) {
val = right;
}
} else if (right == NullConstant.v()) {
if (left != NullConstant.v()) {
val = left;
}
}
// if we compare a local with null then process further...
if (val != null && val instanceof Local) {
if (eqExpr instanceof JEqExpr)
// a==null
handleEquality(val, out, outBranch);
else if (eqExpr instanceof JNeExpr)
// a!=null
handleNonEquality(val, out, outBranch);
else
throw new IllegalStateException("unexpected condition: " + eqExpr.getClass());
}
}
use of soot.jimple.internal.JEqExpr in project soot by Sable.
the class NullnessAnalysis method handleIfStmt.
private void handleIfStmt(JIfStmt ifStmt, AnalysisInfo in, AnalysisInfo out, AnalysisInfo outBranch) {
Value condition = ifStmt.getCondition();
if (condition instanceof JInstanceOfExpr) {
// a instanceof X ; if this succeeds, a is not null
JInstanceOfExpr expr = (JInstanceOfExpr) condition;
handleInstanceOfExpression(expr, in, out, outBranch);
} else if (condition instanceof JEqExpr || condition instanceof JNeExpr) {
// a==b or a!=b
AbstractBinopExpr eqExpr = (AbstractBinopExpr) condition;
handleEqualityOrNonEqualityCheck(eqExpr, in, out, outBranch);
}
}
Aggregations