public static boolean isRelevant(Unit q) { if(q instanceof JAssignStmt){ JAssignStmt as=(JAssignStmt)q; return SootUtilities.isFieldLoad(as)|| SootUtilities.isStoreInst(as) || SootUtilities.isNewStmt(as)|| SootUtilities.isLoadInst(as)|| SootUtilities.isFieldStore(as) || SootUtilities.isStaticGet(as)|| SootUtilities.isStaticPut(as) || SootUtilities.isInvoke(as) || SootUtilities.isNewArrayStmt(as); } return SootUtilities.isInvoke(q) || (q instanceof JReturnStmt || q instanceof JReturnVoidStmt)|| q instanceof MonitorStmt; }
private Type getSystemFetcherReturnType(Body b) { ExceptionalUnitGraph g = new ExceptionalUnitGraph(b); SmartLocalDefs localDefs = new SmartLocalDefs(g, new SimpleLiveLocals(g)); SimpleLocalUses localUses = new SimpleLocalUses(g, localDefs); for (Unit u : b.getUnits()) { if (u instanceof JReturnStmt) { JReturnStmt ret = (JReturnStmt) u; Local l = (Local) ret.getOp(); List<Unit> defs = localDefs.getDefsOfAt(l, u); for (Unit d : defs) { if (d instanceof AssignStmt) { AssignStmt ass = (AssignStmt) d; Type t = ass.getRightOp().getType(); if (t instanceof NullType) { System.out.println("warning: null type! " + ass); } else { System.out.println("ok: found return type: " + t); return t; } } } } } System.out.println("warning: no return type found returning void!"); return VoidType.v(); }
private void visitReturnInsts(JReturnStmt s) { if (rivs != null) { for (IReturnInstVisitor v : rivs) { v.visit(s); } } }
@Override public void visit(JReturnStmt rs) { Value op = rs.getOp(); if (op instanceof Local){ Local rx = (Local) op; if(rx.getType() instanceof RefLikeType) { add(ctnrMethod, ZERO, op); } } }
@Override public void visit(JReturnStmt jrs) { if(jrs.getOp() instanceof Local){ Local v = (Local)jrs.getOp(); if(v.getType() instanceof RefLikeType){ add((Unit) jrs, v); } } }
private String getNameFromReturn(Body b) { ExceptionalUnitGraph g = new ExceptionalUnitGraph(b); SmartLocalDefs localDefs = new SmartLocalDefs(g, new SimpleLiveLocals(g)); SimpleLocalUses localUses = new SimpleLocalUses(g, localDefs); for (Unit u : b.getUnits()) { if (u instanceof JReturnStmt) { JReturnStmt ret = (JReturnStmt) u; Local l = (Local) ret.getOp(); List<Unit> defs = localDefs.getDefsOfAt(l, u); for (Unit d : defs) { if (d instanceof AssignStmt) { AssignStmt ass = (AssignStmt) d; // if (ass.getRightOp() instanceof NewExpr) { // JNewExpr n = (JNewExpr)ass.getRightOp(); Type t = ass.getRightOp().getType(); if (t.toString().equals("java.lang.Object")) { if (ass.getRightOp() instanceof InvokeExpr) { InvokeExpr ie = (InvokeExpr) ass.getRightOp(); t = ie.getMethodRef().declaringClass() .getType(); } else { List<Unit> defs2 = localDefs.getDefsOfAt( (Local) ass.getRightOp(), d); Unit u2 = defs2.get(0); if (u2 instanceof AssignStmt) { AssignStmt ass2 = (AssignStmt) u2; t = ass.getRightOp().getType(); } else { throw new RuntimeException( "error: could not find interesting type!"); } } } String name = makeManagerName(t); return name; // } } } } } System.out.println("warning: no name found! " + b); return "Unknown" + unknowni++; }
public void visit(JReturnStmt s) { add(s, s.getOp()); }
public void visit(JReturnStmt s);