Ejemplo n.º 1
0
 public static ReachabilityAnalysis Create(IList<ControlFlowNode> controlFlowGraph, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (controlFlowGraph == null)
         throw new ArgumentNullException("controlFlowGraph");
     ReachabilityAnalysis ra = new ReachabilityAnalysis();
     ra.stack.Push(controlFlowGraph[0]);
     while (ra.stack.Count > 0) {
         cancellationToken.ThrowIfCancellationRequested();
         ra.MarkReachable(ra.stack.Pop());
     }
     ra.stack = null;
     ra.visitedNodes = null;
     return ra;
 }
Ejemplo n.º 2
0
        public static ReachabilityAnalysis Create(IList <ControlFlowNode> controlFlowGraph, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (controlFlowGraph == null)
            {
                throw new ArgumentNullException("controlFlowGraph");
            }
            ReachabilityAnalysis ra = new ReachabilityAnalysis();

            ra.stack.Push(controlFlowGraph[0]);
            while (ra.stack.Count > 0)
            {
                cancellationToken.ThrowIfCancellationRequested();
                ra.MarkReachable(ra.stack.Pop());
            }
            ra.stack        = null;
            ra.visitedNodes = null;
            return(ra);
        }
Ejemplo n.º 3
0
        public static ReachabilityAnalysis Create(IList <ControlFlowNode> controlFlowGraph, RecursiveDetectorVisitor recursiveDetectorVisitor = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (controlFlowGraph == null)
            {
                throw new ArgumentNullException("controlFlowGraph");
            }
            ReachabilityAnalysis ra = new ReachabilityAnalysis();

            ra.recursiveDetectorVisitor = recursiveDetectorVisitor;
            // Analysing a null node can result in an empty control flow graph
            if (controlFlowGraph.Count > 0)
            {
                ra.stack.Push(controlFlowGraph[0]);
                while (ra.stack.Count > 0)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    ra.MarkReachable(ra.stack.Pop());
                }
            }
            ra.stack        = null;
            ra.visitedNodes = null;
            return(ra);
        }