Exemple #1
0
 private static Block FindLoopHeaderWithStateName(string StateName, Microsoft.Boogie.GraphUtil.Graph <Block> CFG)
 {
     foreach (var b in CFG.Headers)
     {
         foreach (var c in b.Cmds.OfType <AssumeCmd>())
         {
             var stateId = QKeyValue.FindStringAttribute(c.Attributes, "captureState");
             if (stateId == StateName)
             {
                 return(b);
             }
         }
     }
     return(null);
 }
Exemple #2
0
        // From [CLR, pg. 483]
        private void dfs(Microsoft.Boogie.GraphUtil.Graph <string> callGraph, string node, Dictionary <string, int> color, HashSet <Tuple <string, string> > ret)
        {
            Debug.Assert(color[node] == 0);

            // gray
            color[node] = 1;

            foreach (var s in callGraph.Successors(node))
            {
                // backedge
                if (color[s] == 1)
                {
                    ret.Add(Tuple.Create(node, s));
                }

                if (color[s] == 0)
                {
                    dfs(callGraph, s, color, ret);
                }
            }

            // black
            color[node] = 2;
        }