use of soot.Context in project soot by Sable.
the class OnFlyCallGraph method updatedNode.
public void updatedNode(VarNode vn) {
Object r = vn.getVariable();
if (!(r instanceof Local))
return;
final Local receiver = (Local) r;
final Context context = vn.context();
PointsToSetInternal p2set = vn.getP2Set().getNewSet();
if (ofcgb.wantTypes(receiver)) {
p2set.forall(new P2SetVisitor() {
public final void visit(Node n) {
if (n instanceof AllocNode)
ofcgb.addType(receiver, context, n.getType(), (AllocNode) n);
}
});
}
if (ofcgb.wantStringConstants(receiver)) {
p2set.forall(new P2SetVisitor() {
public final void visit(Node n) {
if (n instanceof StringConstantNode) {
String constant = ((StringConstantNode) n).getString();
ofcgb.addStringConstant(receiver, context, constant);
} else {
ofcgb.addStringConstant(receiver, context, null);
}
}
});
}
if (ofcgb.wantInvokeArg(receiver)) {
p2set.forall(new P2SetVisitor() {
@Override
public void visit(Node n) {
if (n instanceof AllocNode) {
AllocNode an = ((AllocNode) n);
ofcgb.addInvokeArgDotField(receiver, an.dot(ArrayElement.v()));
assert an.getNewExpr() instanceof NewArrayExpr;
NewArrayExpr nae = (NewArrayExpr) an.getNewExpr();
if (!(nae.getSize() instanceof IntConstant)) {
ofcgb.setArgArrayNonDetSize(receiver, context);
} else {
IntConstant sizeConstant = (IntConstant) nae.getSize();
ofcgb.addPossibleArgArraySize(receiver, sizeConstant.value, context);
}
}
}
});
for (Type ty : pag.reachingObjectsOfArrayElement(p2set).possibleTypes()) {
ofcgb.addInvokeArgType(receiver, context, ty);
}
}
}
Aggregations