public RightExpression(APC pc, LazyEval <BoxedExpression> assignment)
        {
            Contract.Requires(assignment != null);

            this.PC         = pc;
            this.assignment = assignment;
        }
                public override DisjunctiveRefinement Binary(APC pc, BinaryOperator op, Variable dest, Variable s1, Variable s2, DisjunctiveRefinement data)
                {
                    this.InferExceptionHandlers(pc);

                    // We want to save the PC where "dest" first appeared.
                    // We will need this information in the code fixes, because we need the expression source context, and not the statement where it appears
                    if (!this.FirstViewAt.ContainsKey(dest))
                    {
                        this.FirstViewAt[dest] = pc;
                    }

                    if (!op.IsComparisonBinaryOperator())
                    {
                        var rValueExp = new LazyEval <BoxedExpression>(
                            () =>
                        {
                            var left  = BoxedExpression.Convert(this.Context.ExpressionContext.Refine(pc, s1), this.MethodDriver.ExpressionDecoder, MAXDEPTH);
                            var right = BoxedExpression.Convert(this.Context.ExpressionContext.Refine(pc, s2), this.MethodDriver.ExpressionDecoder, MAXDEPTH);
                            // conversion may fail, so let us check it
                            return((left != null && right != null)?
                                   BoxedExpression.Binary(op, left, right, dest) :
                                   null);
                        });

                        this.RightExpressions.Add(new RightExpression(pc, rValueExp));
                    }
                    return(data);
                }
        public SyntacticTest(Polarity kind, APC pc, string tag, LazyEval <BoxedExpression> guard)
        {
            Contract.Requires(tag != null);
            Contract.Requires(guard != null);

            this.Kind  = kind;
            this.PC    = pc;
            this.Tag   = tag;
            this.guard = guard;
        }
        public CodeFixesForOverflowingExpression(APC pc, IFactQuery <BoxedExpression, Var> facts, LazyEval <BoxedExpression> ZeroExp)
        {
            Contract.Requires(facts != null);
            Contract.Requires(ZeroExp != null);

            this.PC             = pc;
            this.Facts          = facts;
            this.OverflowOracle = new FactQueryForOverflow <Var>(facts);
            this.ExpressionTags = new Dictionary <BoxedExpression, State>();
            this.ZeroExp        = ZeroExp;
            this.PartialResult  = null;
        }
                public override DisjunctiveRefinement Assume(APC pc, string tag, Variable source, object provenance, DisjunctiveRefinement data)
                {
                    Contract.Assume(data != null);
                    this.InferExceptionHandlers(pc);

                    var refinedExp = new LazyEval <BoxedExpression>(
                        () => BoxedExpression.Convert(this.Context.ExpressionContext.Refine(pc, source), this.MethodDriver.ExpressionDecoder, MAXDEPTH));

                    if (tag != "false")
                    {
                        var toRefine = source;

                        // in clousot1 we refine "assume refinedExp".
                        // in clousot2 we refinedExp may be exp != 0 and in this case we refine "assume exp"
                        if (!this.MethodDriver.SyntacticComplexity.TooManyJoinsForBackwardsChecking &&
                            refinedExp.Value != null && CanRefineAVariableTruthValue(refinedExp.Value, ref toRefine))
                        {
                            Log("Trying to refine the variable {0} to one containing logical connectives", refinedExp.Value.UnderlyingVariable.ToString);

                            BoxedExpression refinedExpWithConnectives;
                            if (TryToBoxedExpressionWithBooleanConnectives(pc, tag, toRefine, false,
                                                                           TopNumericalDomain <BoxedVariable <Variable>, BoxedExpression> .Singleton, out refinedExpWithConnectives))
                            {
                                Log("Succeeded. Got {0}", refinedExpWithConnectives.ToString);

                                data[new BoxedVariable <Variable>(source)] = new SetOfConstraints <BoxedExpression>(refinedExpWithConnectives);
                            }
                        }
                    }

                    APC pcForExpression;

                    if (!this.FirstViewAt.TryGetValue(source, out pcForExpression))
                    {
                        pcForExpression = pc;
                    }

                    this.Tests.Add(new SyntacticTest(SyntacticTest.Polarity.Assume, pcForExpression, tag, refinedExp));

                    // We do not call the base Assume as it performs too many things not needed here
                    return(data);
                }
Esempio n. 6
0
 public Foo()
 {
     LazyProperty = () => new MyClass();
 }
Esempio n. 7
0
 public Foo()
 {
     LazyProperty = () => this.PublicProperty;
 }