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);
        }
Ejemplo n.º 4
0
				private StatementIssueCollector (GatherVisitor visitor, ReachabilityAnalysis reachability)
				{
					collectedStatements = new HashSet<Statement> ();
					this.visitor = visitor;
					this.reachability = reachability;
				}
Ejemplo n.º 5
0
		/// <summary>
		/// Creates a new reachability analysis object with a given statement.
		/// </summary>
		/// <param name="statement">
		/// The statement to start the analysis.
		/// </param>
		/// <param name="recursiveDetectorVisitor">
		/// TODO.
		/// </param>
		/// <returns>
		/// The reachability analysis object.
		/// </returns>
		public ReachabilityAnalysis CreateReachabilityAnalysis (Statement statement, ReachabilityAnalysis.RecursiveDetectorVisitor recursiveDetectorVisitor = null)
		{
			return ReachabilityAnalysis.Create (statement, resolver, recursiveDetectorVisitor, CancellationToken);
		}