Class CallGraphTransitiveClosure

java.lang.Object
com.ibm.wala.ipa.callgraph.CallGraphTransitiveClosure

public class CallGraphTransitiveClosure extends Object
Utility class for computing an analysis result for call graph nodes and their transitive callees, given the results for individual nodes.
  • Constructor Details

    • CallGraphTransitiveClosure

      public CallGraphTransitiveClosure()
  • Method Details

    • transitiveClosure

      public static <T> Map<CGNode, OrdinalSet<T>> transitiveClosure(CallGraph cg, Map<CGNode, Collection<T>> nodeResults)
      Compute the transitive closure of an analysis result over all callees.

      The closure is computed over the strongly connected components of cg, callees first. Each component's result is the union of its members' own results and the results of the components its members call, so every node in a component shares the same result.

      The elements of the results are identified by Object.equals(Object) and Object.hashCode(), so equal elements are treated as one, and an element must not change in a way that affects either method while the closure is computed.

      Parameters:
      cg - the call graph
      nodeResults - analysis result for each individual node
      Returns:
      a map from each node to the analysis result for the node and its transitive callees
    • collectNodeResults

      public static <T> Map<CGNode, Collection<T>> collectNodeResults(CallGraph cg, Function<CGNode, Collection<T>> nodeResultComputer)
      Collect analysis result for each CGNode in a Map.