Esempio n. 1
0
 public virtual Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     Contract.Requires(node != null);
     Contract.Ensures(Contract.Result <Cmd>() != null);
     node.Requires = this.VisitRequires(node.Requires);
     node.Expr     = this.VisitExpr(node.Expr);
     return(node);
 }
Esempio n. 2
0
 private Cmd InlinedRequires(CallCmd callCmd, Requires req) {
   Requires/*!*/ reqCopy = (Requires/*!*/)cce.NonNull(req.Clone());
   if (req.Free)
     reqCopy.Condition = Expr.True;
   else 
     reqCopy.Condition = codeCopier.CopyExpr(req.Condition);
   AssertCmd/*!*/ a = new AssertRequiresCmd(callCmd, reqCopy);
   a.ErrorDataEnhanced = reqCopy.ErrorDataEnhanced;
   return a;
 }
Esempio n. 3
0
 public override Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     return(base.VisitAssertRequiresCmd((AssertRequiresCmd)node.Clone()));
 }
Esempio n. 4
0
 public override Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     AddHoudiniConstant(node);
     return(base.VisitAssertRequiresCmd(node));
 }
Esempio n. 5
0
 public override Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     //Contract.Requires(node != null);
     Contract.Ensures(Contract.Result <Cmd>() != null);
     return(base.VisitAssertRequiresCmd((AssertRequiresCmd)node.Clone()));
 }
Esempio n. 6
0
 public override Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     //ignore requires node for now, TODO
     return(VisitAssertCmd(node));
 }
Esempio n. 7
0
        public void NewProblem(string descriptiveName, VCExpr vc, ProverInterface.ErrorHandler handler)
        {
            Contract.Requires(descriptiveName != null);
            Contract.Requires(vc != null);
            Contract.Requires(handler != null);
            HashSet <string /*!*/> /*!*/ labels = FindLabelsVisitor.FindLabels(vc);

            Contract.Assert(labels != null);
            toInspector.WriteLine("PROBLEM " + descriptiveName);
            toInspector.WriteLine("TOKEN BEGIN");
            foreach (string lab in labels)
            {
                Contract.Assert(lab != null);
                string no   = lab.Substring(1);
                Absy   absy = handler.Label2Absy(no);

                IToken    tok   = absy.tok;
                AssertCmd assrt = absy as AssertCmd;
                Block     blk   = absy as Block;
                string    val   = tok.val; // might require computation, so cache it
                if (val == "foo" || tok.filename == null)
                {
                    continue;                               // no token
                }
                toInspector.Write("TOKEN ");
                toInspector.Write(lab);
                toInspector.Write(" ");

                if (assrt != null)
                {
                    toInspector.Write("ASSERT");
                    string errData = assrt.ErrorData as string;
                    if (errData != null)
                    {
                        val = errData;
                    }
                    else if (assrt.ErrorMessage != null)
                    {
                        val = assrt.ErrorMessage;
                    }
                }
                else if (blk != null)
                {
                    toInspector.Write("BLOCK ");
                    toInspector.Write(blk.Label);
                }
                else
                {
                    Contract.Assume(false);
                }
                if (val == null || val == "assert" || val == "ensures")
                {
                    val = "";
                }

                if (absy is LoopInitAssertCmd)
                {
                    val += " (loop entry)";
                }
                else if (absy is LoopInvMaintainedAssertCmd)
                {
                    val += " (loop body)";
                }
                else if (val.IndexOf("#VCCERR") >= 0)
                {
                    // skip further transformations
                }
                else if (absy is AssertRequiresCmd)
                {
                    AssertRequiresCmd req  = (AssertRequiresCmd)absy;
                    IToken            t2   = req.Requires.tok;
                    string            tval = t2.val;
                    if (tval == "requires")
                    {
                        tval = string.Format("{0}({1},{2}))", t2.filename, t2.line, t2.col);
                    }
                    string call = "";
                    if (val != "call")
                    {
                        call = " in call to " + val;
                    }
                    val = string.Format("precondition {0}{1}", tval, call);
                }

                val = val.Replace("\r", "").Replace("\n", " ");

                toInspector.WriteLine(string.Format(" {0} {1} :@:{2}:@:{3}", tok.line, tok.col, tok.filename, val));
            }
            toInspector.WriteLine("TOKEN END");
        }
Esempio n. 8
0
 public override Cmd VisitAssertRequiresCmd(AssertRequiresCmd node)
 {
     node.IncarnationMap = null;
     return(base.VisitAssertRequiresCmd(node));
 }