/** * Removes all outgoing edges that start at the given unit * * @param u * The unit from which to remove all outgoing edges * @return True if at least one edge has been removed, otherwise false */ public boolean removeAllEdgesOutOf(Unit u) { boolean hasRemoved = false; for (QueueReader<Edge> edgeRdr = listener(); edgeRdr.hasNext();) { Edge e = edgeRdr.next(); if (e.srcUnit() == u) { removeEdge(e); hasRemoved = true; } } return hasRemoved; }
cg.removeEdge(p.sootEdge);
protected void internalTransform(Body b, String phaseName, Map options) { ClinitElimAnalysis a = new ClinitElimAnalysis(new BriefUnitGraph(b)); CallGraph cg = Scene.v().getCallGraph(); SootMethod m = b.getMethod(); Iterator edgeIt = cg.edgesOutOf(m); while (edgeIt.hasNext()) { Edge e = (Edge) edgeIt.next(); if (e.srcStmt() == null) { continue; } if (!e.isClinit()) { continue; } FlowSet methods = (FlowSet) a.getFlowBefore(e.srcStmt()); if (methods.contains(e.tgt())) { cg.removeEdge(e); } } } }
/** * Swaps an invocation statement. All edges that previously went from the given statement to some callee now go from the * new statement to the same callee. This method is intended to be used when a Jimple statement is replaced, but the * replacement does not semantically affect the edges. * * @param out * The old statement * @param in * The new statement * @return True if at least one edge was affected by this operation */ public boolean swapEdgesOutOf(Stmt out, Stmt in) { boolean hasSwapped = false; for (QueueReader<Edge> edgeRdr = listener(); edgeRdr.hasNext();) { Edge e = edgeRdr.next(); if (e.srcUnit() == out) { removeEdge(e); addEdge(new Edge(e.getSrc(), in, e.getTgt())); hasSwapped = true; } } return hasSwapped; }
Edge e = (Edge) edges.next(); cg.addEdge(new Edge(ct, newStmt, e.tgt(), e.kind())); cg.removeEdge(e);
protected void internalTransform(Body b, String phaseName, Map options){ ClinitElimAnalysis a = new ClinitElimAnalysis( new BriefUnitGraph(b)); CallGraph cg = Scene.v().getCallGraph(); SootMethod m = b.getMethod(); Iterator edgeIt = cg.edgesOutOf(m); while (edgeIt.hasNext()){ Edge e = (Edge)edgeIt.next(); if (e.srcStmt() == null) continue; if (!e.isClinit()) continue; FlowSet methods = (FlowSet) a.getFlowBefore(e.srcStmt()); if (methods.contains(e.tgt())){ cg.removeEdge(e); } } } }
protected void internalTransform(Body b, String phaseName, Map options){ ClinitElimAnalysis a = new ClinitElimAnalysis( new BriefUnitGraph(b)); CallGraph cg = Scene.v().getCallGraph(); SootMethod m = b.getMethod(); Iterator edgeIt = cg.edgesOutOf(m); while (edgeIt.hasNext()){ Edge e = (Edge)edgeIt.next(); if (e.srcStmt() == null) continue; if (!e.isClinit()) continue; FlowSet methods = (FlowSet) a.getFlowBefore(e.srcStmt()); if (methods.contains(e.tgt())){ cg.removeEdge(e); } } } }
Scene.v().getCallGraph().removeEdge(edge); callEdgesRemoved++;