use of org.mapleir.deob.callgraph.CallGraphEdge.SiteInvocationEdge in project maple-ir by LLVM-but-worse.
the class SensitiveCallGraphBuilder method process.
@Override
public void process(Worklist<MethodNode> worklist, MethodNode n) {
if (worklist != this.worklist) {
throw new IllegalStateException();
}
if (worklist.hasProcessed(n)) {
throw new UnsupportedOperationException(String.format("Already processed %s", n));
}
/* this is not the same as getNode */
CallGraphNode.CallReceiverNode currentReceiverNode = createNode(n, false);
ControlFlowGraph cfg = context.getIRCache().get(n);
if (cfg == null) {
return;
}
for (Stmt stmt : cfg.stmts()) {
for (Expr e : stmt.enumerateOnlyChildren()) {
if (e instanceof Invocation) {
Invocation invoke = (Invocation) e;
CallGraphNode.CallSiteNode thisCallSiteNode = callGraph.addInvocation(n, invoke);
/* link the current receiver to this call site. */
FunctionOwnershipEdge foe = new FunctionOwnershipEdge(currentReceiverNode, thisCallSiteNode);
callGraph.addEdge(currentReceiverNode, foe);
Set<MethodNode> targets = invoke.resolveTargets(context.getInvocationResolver());
for (MethodNode target : targets) {
CallGraphNode.CallReceiverNode targetReceiverNode = createNode(target, true);
/* link each target to the call site. */
SiteInvocationEdge sie = new SiteInvocationEdge(thisCallSiteNode, targetReceiverNode);
callGraph.addEdge(thisCallSiteNode, sie);
}
}
}
}
}
Aggregations