private boolean sameCondLocal(Stmt s1, Stmt s2) { AssignStmt as1 = (AssignStmt) s1; IfStmt is2 = (IfStmt) s2; if (is2.getCondition() instanceof BinopExpr) { BinopExpr bs2 = (BinopExpr) is2.getCondition(); if (as1.getLeftOp().equals(bs2.getOp1())) { return true; } } return false; } }
@Override public void caseIfStmt(IfStmt s) { result = result.add(mightThrow(s.getCondition())); }
public void caseIfStmt(IfStmt stmt) { this.handleBinopExpr((BinopExpr) stmt.getCondition(), stmt, BooleanType.v()); }
public IfStmt newIfStmt(IfStmt s) { return new GIfStmt(s.getCondition(), s.getTarget()); }
Value cmpcond = ((IfStmt) stmt).getCondition();
/** * Collect all the if statements comparing two locals with an Eq or Ne expression * * @param body * the body to analyze */ private Set<IfStmt> getNullIfCandidates(Body body) { Set<IfStmt> candidates = new HashSet<IfStmt>(); Iterator<Unit> i = body.getUnits().iterator(); while (i.hasNext()) { Unit u = i.next(); if (u instanceof IfStmt) { ConditionExpr expr = (ConditionExpr) ((IfStmt) u).getCondition(); boolean isTargetIf = false; if (((expr instanceof EqExpr) || (expr instanceof NeExpr))) { if (expr.getOp1() instanceof Local && expr.getOp2() instanceof Local) { isTargetIf = true; } } if (isTargetIf) { candidates.add((IfStmt) u); } } } return candidates; }
public ASTNode emit_AST() { return new ASTDoWhileNode(get_Label(), (ConditionExpr) ((IfStmt) get_CharacterizingStmt().get_Stmt()).getCondition(), emit_ASTBody(body2childChain.get(subBodies.get(0)))); }
public ASTNode emit_AST() { return new ASTWhileNode(get_Label(), (ConditionExpr) ((IfStmt) get_CharacterizingStmt().get_Stmt()).getCondition(), emit_ASTBody(body2childChain.get(subBodies.get(0)))); }
@Override public void caseIfStmt(IfStmt stmt) { Stmt target = stmt.getTarget(); exprV.setOrigStmt(stmt); exprV.setTargetForOffset(target); stmt.getCondition().apply(exprV); }
public ASTNode emit_AST() { List<Object> astBody0 = emit_ASTBody(body2childChain.get(ifBody)), astBody1 = emit_ASTBody(body2childChain.get(elseBody)); ConditionExpr ce = (ConditionExpr) ((IfStmt) get_CharacterizingStmt().get_Stmt()).getCondition(); if (astBody0.isEmpty()) { List<Object> tbody = astBody0; astBody0 = astBody1; astBody1 = tbody; ce = ConditionFlipper.flip(ce); } if (astBody1.isEmpty()) { return new ASTIfNode(get_Label(), ce, astBody0); } else { return new ASTIfElseNode(get_Label(), ce, astBody0, astBody1); } } }
ConditionExpr expr = (ConditionExpr) ((IfStmt) u).getCondition(); if (isZeroComparison(expr) && expr.getOp1() instanceof Local) { if (candidates == null) {
@Override public void caseIfStmt(IfStmt stmt) { // add constraint Value c = stmt.getCondition(); if (c instanceof BinopExpr) { BinopExpr bo = (BinopExpr) c; Value op1 = bo.getOp1(); Value op2 = bo.getOp2(); if (op1 instanceof Local && op2 instanceof Local) { DalvikTyper.v().addConstraint(bo.getOp1Box(), bo.getOp2Box()); } } }
public void caseIfStmt(IfStmt stmt) { String varName = printValueAssignment(stmt.getCondition(), "condition"); Unit target = stmt.getTarget(); vtp.suggestVariableName("target"); String targetName = vtp.getLastAssignedVarName(); p.println("Unit " + targetName + "=" + nameOfJumpTarget(target) + ";"); printStmt(stmt, varName, targetName); }
@Override public void caseIfStmt(IfStmt stmt) { Value c = stmt.getCondition(); if (c instanceof BinopExpr) { BinopExpr be = (BinopExpr) c;
/** * Replace 0 with null in the given unit. * * @param u * the unit where 0 will be replaced with null. */ protected void replaceWithNull(Unit u) { if (u instanceof IfStmt) { ConditionExpr expr = (ConditionExpr) ((IfStmt) u).getCondition(); if (isZeroComparison(expr)) { expr.setOp2(NullConstant.v()); } } else if (u instanceof AssignStmt) { AssignStmt s = (AssignStmt) u; Value v = s.getRightOp(); if ((v instanceof IntConstant && ((IntConstant) v).value == 0) || (v instanceof LongConstant && ((LongConstant) v).value == 0)) { // If this is a field assignment, double-check the type. We // might have a.f = 2 with a being a null candidate, but a.f // being an int. if (!(s.getLeftOp() instanceof InstanceFieldRef) || ((InstanceFieldRef) s.getLeftOp()).getFieldRef().type() instanceof RefLikeType) { s.setRightOp(NullConstant.v()); } } } }
IfStmt ifs = (IfStmt) stmt; Value cond = ifs.getCondition(); if (Evaluator.isValueConstantValued(cond)) { cond = Evaluator.getConstantValueOf(cond);
public void caseIfStmt(IfStmt stmt) { if (uses) { ConditionExpr cond = (ConditionExpr) stmt.getCondition();
public void caseIfStmt(IfStmt stmt) { if (uses) { ConditionExpr cond = (ConditionExpr) stmt.getCondition();
public void caseIfStmt(IfStmt stmt) { ConditionExpr cond = (ConditionExpr) stmt.getCondition();
public void caseIfStmt(IfStmt stmt) { ConditionExpr cond = (ConditionExpr) stmt.getCondition();