protected override object VisitCall(Variable dest, Variable receiver, Method callee, ExpressionList arguments, bool virtcall, Statement stat, object arg) { //Console.Out.WriteLine("{0} -> {1}", current.FullName, callee.FullName); if (IsInterestingCall(callee)) { cg.AddCall(current, callee, new Label(stat, current), virtcall); } return(arg); }
internal static CallGraph<string, int> GenerateCallGraph(int n) { var result = new CallGraph<string,int>(); for (var i = 0; i < n; i++) { result.Add(string.Format("N{0}", i)); } // now generate the edges var rand = new Random(); for (var i = 0; i < 5 * n; i++) { var source = rand.Next(n - 1); var dest = rand.Next(n - 1); result.AddCall(string.Format("N{0}", source), string.Format("N{0}", dest)); } result.Add("Main"); result.AddRootMethod("Main"); foreach (var method in result.GetNodes()) { result.AddCall("Main", method); } return result; }