Example #1
0
  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) {
              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);
              }
            }
          });
    }
  }
Example #2
0
  /**
   * Transform the result to SPARK style context insensitive points-to set. The transformed result
   * is stored in the points-to set of the querying pointer.
   *
   * @param vn: the querying pointer
   * @return
   */
  public PointsToSet toSparkCompatiableResult(VarNode vn) {
    if (!readyToUse) finish();

    PointsToSetInternal ptset = vn.makeP2Set();

    for (VarType cv : outList) {
      ptset.add(cv.var);
    }

    return ptset;
  }