// Checks for the following: // -- There should be no ensures and requires on shared globals // -- For ensures and requires on non-shared globals, they should be "free" // -- One cannot use "old" versions of shared globals public static void check(Program prog) { // Gather the set of procs with an implementation var procsWithImpl = new HashSet <string>(); foreach (var decl in prog.TopLevelDeclarations) { if (decl is Implementation) { procsWithImpl.Add((decl as Implementation).Name); } } ProgramCallGraph pg = new ProgramCallGraph(prog); var procsNotCalled = new HashSet <string>(); foreach (var proc in procsWithImpl) { if (!pg.isCalled(proc)) { procsNotCalled.Add(proc); } } foreach (Declaration decl in prog.TopLevelDeclarations) { if (decl is Procedure) { checkProc(decl as Procedure, procsWithImpl, procsNotCalled); } else if (decl is Implementation) { checkOld(decl as Implementation); } } }
public ProgramInfo(string main, Program prog, string assertNotReachableName) { mainProcName = main; mainProcExists = false; this.assertNotReachableName = assertNotReachableName; allProcs = new HashSet <string>(); procsWithImplementation = new HashSet <string>(); asyncProcs = new HashSet <string>(); procsWithAssert = new HashSet <string>(); procsWithAsync = new HashSet <string>(); declaredGlobals = new Dictionary <string, GlobalVariable>(); modifiedGlobals = new Dictionary <string, GlobalVariable>(); threadLocalGlobals = new Dictionary <string, GlobalVariable>(); threadIdType = Microsoft.Boogie.Type.Int; infoGathered = false; callGraph = new ProgramCallGraph(prog); VisitProgram(prog); }