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; }
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); }
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); }