Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (C) 2015 The Pennsylvania State University and the University of Wisconsin
  * Systems and Internet Infrastructure Security Laboratory
  *
  * Author: Damien Octeau
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.psu.cse.siis.coal;
import soot.Unit;
import soot.Value;
A factory for normal edge functions. Normal edge functions indicate how values are propagated through normal (non-call) statements.
public class NormalEdgeFunctionFactory {
  private final Logger logger = LoggerFactory.getLogger(getClass());

  
Returns a normal edge function.

Parameters:
curr The current statement.
currNode The current variable.
succNode The variable the current variable is propagated to after the statement.
zeroValue The zero value, which represents the absence of a data flow fact.
pointsToAnalysis The pointer analysis.
Returns:
A normal edge function.
      Value succNodeValue zeroValuePointsToAnalysis pointsToAnalysis) {
    if (curr instanceof AssignStmt) {
      if (.isDebugEnabled()) {
        .debug("Normal edge: " + curr);
        .debug(currNode + " " + succNode);
      }
      AssignStmt assignStmt = (AssignStmtcurr;
      final Value left = assignStmt.getLeftOp();
      final String type = left.getType().toString();
      final Value right = assignStmt.getRightOp();
      if (Model.v().isModeledType(type)) {
        if (currNode.equivTo(zeroValue) && succNode.equivTo(left)) {
          if (right instanceof StaticFieldRef) {
            StaticFieldRef staticFieldRef = (StaticFieldRefright;
            Argument[] arguments =
                Model.v().getArgumentsForStaticField(staticFieldRef.getField().getSignature());
            EdgeFunction<BasePropagationValueresult =
                PropagationTransformerFactory.makeTransformer(nullargumentsfalse);
            if (arguments != null) {
              if (.isDebugEnabled()) {
                .debug("Returning " + result);
              }
              return PropagationTransformerFactory.makeTransformer(nullargumentsfalse);
            }
          } else if (right instanceof NullConstant) {
            return PropagationTransformerFactory.makeTransformer(nullnullfalse);
          }
        }
      }
    }
    return EdgeIdentity.v();
  }
New to GrepCode? Check out our FAQ X