Пример #1
0
        private Program PrepareBoogie(Microsoft.FSharp.Collections.FSharpList<BoogieAST.Decl> boogieDecls)
        {
            var boogieProgram = parent.GetBoogieProgram(boogieDecls);
              CloseVcGen();
              CommandLineOptions.Clo.Parse(standardBoogieOptions);
              IErrorSink errorSink = new BoogieErrorSink(parent.options.NoPreprocessor);

              int numErrors;

              try {
            parent.swBoogieResolve.Start();
            numErrors = boogieProgram.Resolve(errorSink);
              } finally {
            parent.swBoogieResolve.Stop();
              }
              if (numErrors == 0) {
            try {
              parent.swBoogieTypecheck.Start();
              numErrors = boogieProgram.Typecheck(errorSink);
            } finally {
              parent.swBoogieTypecheck.Stop();
            }
              }
              if (numErrors == 0) {
            try {
              parent.swBoogieAI.Start();
              AbstractInterpretation.RunAbstractInterpretation(boogieProgram);
            } finally {
              parent.swBoogieAI.Stop();
            }
              }

              if (Boogie.CommandLineOptions.Clo.ExpandLambdas && numErrors == 0) {
            Boogie.LambdaHelper.ExpandLambdas(boogieProgram);
              }

              if (numErrors != 0) {
            VccCommandLineHost.IncreaseErrorCount();
            if (!parent.options.RunTestSuite) {
              Logger.Instance.Error("attempting to dump BPL to buggy.bpl");
              var filename = "buggy.bpl";
              if (parent.options.OutputDir != null)
              {
            filename = Path.Combine(parent.options.OutputDir, filename);
              }

              CommandLineOptions.Install(new CommandLineOptions());
              using(TokenTextWriter writer = new TokenTextWriter(filename))
            boogieProgram.Emit(writer);
            }
            errorMode = true;
              }

              return boogieProgram;
        }
Пример #2
0
        private Program PrepareBoogie(Microsoft.FSharp.Collections.FSharpList <BoogieAST.Decl> boogieDecls)
        {
            var boogieProgram = parent.GetBoogieProgram(boogieDecls);

            CloseVcGen();
            CommandLineOptions.Clo.Parse(standardBoogieOptions);
            IErrorSink errorSink = new BoogieErrorSink(parent.options.NoPreprocessor);

            int numErrors;

            try {
                parent.swBoogieResolve.Start();
                numErrors = boogieProgram.Resolve(errorSink);
            } finally {
                parent.swBoogieResolve.Stop();
            }
            if (numErrors == 0)
            {
                try {
                    parent.swBoogieTypecheck.Start();
                    numErrors = boogieProgram.Typecheck(errorSink);
                } finally {
                    parent.swBoogieTypecheck.Stop();
                }
            }
            if (numErrors == 0)
            {
                try {
                    parent.swBoogieAI.Start();
                    AbstractInterpretation.RunAbstractInterpretation(boogieProgram);
                } finally {
                    parent.swBoogieAI.Stop();
                }
            }

            if (Boogie.CommandLineOptions.Clo.ExpandLambdas && numErrors == 0)
            {
                Boogie.LambdaHelper.ExpandLambdas(boogieProgram);
            }

            if (numErrors != 0)
            {
                VccCommandLineHost.IncreaseErrorCount();
                if (!parent.options.RunTestSuite)
                {
                    Logger.Instance.Error("attempting to dump BPL to buggy.bpl");
                    var filename = "buggy.bpl";
                    if (parent.options.OutputDir != null)
                    {
                        filename = Path.Combine(parent.options.OutputDir, filename);
                    }

                    CommandLineOptions.Install(new CommandLineOptions());
                    using (TokenTextWriter writer = new TokenTextWriter(filename))
                        boogieProgram.Emit(writer);
                }
                errorMode = true;
            }

            return(boogieProgram);
        }