@Override public void visit(Value e) { if (e instanceof SubExpr) { SubExpr se = (SubExpr) e; add(e, se.getOp1(), se.getOp2()); } }
@Override public void caseSubExpr(SubExpr v) { throw new RuntimeException("todo"); }
public void caseSubExpr(SubExpr v) { printBinaryExpr(v); }
private void handleBinopExpr(BinopExpr be, Stmt stmt, Type tlhs) { Value opl = be.getOp1(), opr = be.getOp2(); Type tl = AugEvalFunction.eval_(this.tg, opl, stmt, this.jb), tr = AugEvalFunction.eval_(this.tg, opr, stmt, this.jb); if ( be instanceof AddExpr || be instanceof SubExpr || be instanceof MulExpr || be instanceof DivExpr || be instanceof RemExpr || be instanceof GeExpr || be instanceof GtExpr || be instanceof LeExpr || be instanceof LtExpr || be instanceof ShlExpr || be instanceof ShrExpr || be instanceof UshrExpr ) { if ( tlhs instanceof IntegerType ) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } else if ( be instanceof CmpExpr || be instanceof CmpgExpr || be instanceof CmplExpr ) { // No checks in the original assigner } else if ( be instanceof AndExpr || be instanceof OrExpr || be instanceof XorExpr ) { be.setOp1(this.uv.visit(opl, tlhs, stmt)); be.setOp2(this.uv.visit(opr, tlhs, stmt)); } else if ( be instanceof EqExpr || be instanceof NeExpr ) { if ( tl instanceof BooleanType && tr instanceof BooleanType ) { } else if ( tl instanceof Integer1Type || tr instanceof Integer1Type ) { } else if ( tl instanceof IntegerType ) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } }
@Override public void caseSubExpr(SubExpr se) { stmtV.addInsn(buildCalculatingBinaryInsn("SUB", se.getOp1(), se.getOp2()), origStmt); }
public NumericConstant getResult(BinopExpr binop){ if(DEBUG) System.out.println("Binop expr"+binop); Value leftOp = binop.getOp1(); Value rightOp = binop.getOp2(); int op = 0; if(binop instanceof AddExpr){ op=1; } else if(binop instanceof SubExpr || binop instanceof DCmpExpr || binop instanceof DCmpgExpr || binop instanceof DCmplExpr){ op=2; } else if(binop instanceof MulExpr){ op=3; } if(op == 0){ if(DEBUG){ System.out.println("not add sub or mult"); System.out.println(binop.getClass().getName()); } return null; } NumericConstant constant = null; if(leftOp instanceof LongConstant && rightOp instanceof LongConstant){ if(DEBUG) System.out.println("long constants!!"); if(op ==1) constant = ((LongConstant)leftOp).add((LongConstant)rightOp); else if(op ==2) constant = ((LongConstant)leftOp).subtract((LongConstant)rightOp); else if (op ==3) constant = ((LongConstant)leftOp).multiply((LongConstant)rightOp); } else if(leftOp instanceof DoubleConstant && rightOp instanceof DoubleConstant){ if(DEBUG) System.out.println("double constants!!"); if(op ==1) constant = ((DoubleConstant)leftOp).add((DoubleConstant)rightOp); else if(op ==2) constant = ((DoubleConstant)leftOp).subtract((DoubleConstant)rightOp); else if (op ==3) constant = ((DoubleConstant)leftOp).multiply((DoubleConstant)rightOp); } else if(leftOp instanceof FloatConstant && rightOp instanceof FloatConstant){ if(DEBUG) System.out.println("Float constants!!"); if(op ==1) constant = ((FloatConstant)leftOp).add((FloatConstant)rightOp); else if(op ==2) constant = ((FloatConstant)leftOp).subtract((FloatConstant)rightOp); else if (op ==3) constant = ((FloatConstant)leftOp).multiply((FloatConstant)rightOp); } else if(leftOp instanceof IntConstant && rightOp instanceof IntConstant){ if(DEBUG) System.out.println("Integer constants!!"); if(op ==1) constant = ((IntConstant)leftOp).add((IntConstant)rightOp); else if(op ==2) constant = ((IntConstant)leftOp).subtract((IntConstant)rightOp); else if (op ==3) constant = ((IntConstant)leftOp).multiply((IntConstant)rightOp); } return constant; }
public void caseSubExpr(SubExpr expr) { caseBinopExpr(expr); }
@Override public void caseSubExpr(SubExpr arg0) { translateBinOp(arg0); }
/** * DOC * * @see soot.jimple.ExprSwitch#caseSubExpr(soot.jimple.SubExpr) */ @Override public void caseSubExpr(SubExpr v) { v.getOp1().apply(this); v.getOp2().apply(this); }
@Override public void caseSubExpr(SubExpr v) { throwInvalidWriteException(v); }
@Override public void caseSubExpr(SubExpr v) { handleBinaryExpr(v.getOp1(), v.getOp2()); }
/** * It is not neccessary to treat arithmetic expressions. The SecurityLevels * of this expressions are treated at an other place. * @param v an arithmetic expression */ @Override public void caseSubExpr(SubExpr v) { logger.finest("Sub Expr identified " + callingStmt.toString()); rightElement = RightElement.NOT; }
/** * The method should update the <em>security level</em> of a {@link SubExpr} * , but it is not possible to update the level of an expression. * * @param v * The expression for which the <em>security level</em> should be * updated. * @see soot.jimple.ExprSwitch#caseSubExpr(soot.jimple.SubExpr) * @throws InvalidSwitchException * Always, because the update is not possible. */ @Override public void caseSubExpr(SubExpr v) { throw new SwitchException(getMsg("exception.analysis.switch.update_error", this.getClass().getSimpleName(), v.getClass().getSimpleName(), v.toString(), getSourceLine())); }
/** * Looks up the <em>security level</em> for the given binary expression and * stores the level in {@link SecurityLevelValueReadSwitch#level}. For a * {@link SubExpr} this is the strongest operand <em>security level</em> of * the given binary expression. * * @param v * The expression for which the <em>security level</em> should be * looked up. * @see soot.jimple.ExprSwitch#caseSubExpr(soot.jimple.SubExpr) * @see SecurityLevelValueReadSwitch#handleBinaryOperation(BinopExpr) */ @Override public void caseSubExpr(SubExpr v) { handleBinaryOperation(v); }