public bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { preConditions = null; foreach (var inferencer in this.inferencers) { if (inferencer == null) continue; InferredConditions tmp; if (inferencer.TryInferConditions(obl, codefixesManager, out tmp)) { Contract.Assert(tmp != null); if (preConditions == null) { preConditions = tmp; } else { preConditions.AddRange(tmp); } } } return preConditions != null; }
virtual public bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { var preConds = PreconditionSuggestion.ExpressionsInPreState(obl.ConditionForPreconditionInference, this.MethodDriver.Context, this.MethodDriver.MetaDataDecoder, obl.PC, allowedKinds: ExpressionInPreStateKind.All); preConditions = /*preConds == null ? null : */ preConds.Where(pre => pre.hasVariables).AsInferredPreconditions(isSufficient: true); return /*preConditions != null && */ (preConditions.Any()); }
public bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { preConditions = null; foreach (var inferencer in this.inferencers) { if (inferencer == null) { continue; } InferredConditions tmp; if (inferencer.TryInferConditions(obl, codefixesManager, out tmp)) { Contract.Assert(tmp != null); if (preConditions == null) { preConditions = tmp; } else { preConditions.AddRange(tmp); } } } return(preConditions != null); }
public bool TryInferPrecondition(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredPreconditions preConditions) { DateTime now = DateTime.Now; bool flag = this.inner.TryInferPrecondition(obl, codefixesManager, out preConditions); PreconditionInferenceProfiler.inferenceTime += DateTime.Now - now; if (preConditions == null) return false; if (flag) PreconditionInferenceProfiler.inferred += Enumerable.Count<IInferredPrecond>((IEnumerable<IInferredPrecond>) preConditions); return flag; }
public override bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { // First we try to read exp in the prestate if (base.TryInferConditions(obl, codefixesManager, out preConditions)) { // if we succeed, now we should prove it is a precondition according to Sect. 4 of [CCL-VMCAI11] var necessarypreConditions = preConditions.Where(pre => new PreconditionCheckedAllOverThePathsAnalysis(this.obligations, this.MethodDriver).CheckPreconditionAdmissibility(pre.Expr)).AsInferredPreconditions(); obl.NotifySufficientYetNotNecessaryPreconditions(preConditions.Except(necessarypreConditions)); preConditions = necessarypreConditions; return(necessarypreConditions.Any()); } return(false); }
public bool TryInferPrecondition(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredPreconditions preConditions) { preConditions = (InferredPreconditions) null; foreach (IPreconditionInference preconditionInference in this.inferencers) { InferredPreconditions preConditions1; if (preconditionInference != null && preconditionInference.TryInferPrecondition(obl, codefixesManager, out preConditions1)) { if (preConditions == null) preConditions = preConditions1; else preConditions.AddRange((IEnumerable<IInferredPrecond>) preConditions1); } } return preConditions != null; }
public ContractInferenceManager(bool CanAddPreconditions, IOverriddenMethodPreconditionsDispatcher overriddenMethodPreconditionsDispatcher, PreconditionInferenceManager precondition, IObjectInvariantDispatcher invariants, IPostconditionDispatcher postcondition, IAssumeDispatcher assumptions, ICodeFixesManager codefixesManager, IOutput output) { Contract.Requires(overriddenMethodPreconditionsDispatcher != null); Contract.Requires(precondition != null); Contract.Requires(invariants != null); Contract.Requires(postcondition != null); Contract.Requires(assumptions != null); Contract.Requires(codefixesManager != null); Contract.Requires(output != null); this.CanAddPreconditions = CanAddPreconditions; this.OverriddenMethodPreconditionDispatcher = overriddenMethodPreconditionsDispatcher; this.PreCondition = precondition; this.ObjectInvariant = invariants; this.PostCondition = postcondition; this.Assumptions = assumptions; this.CodeFixesManager = codefixesManager; this.Output = output; }
public bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { var watch = new Stopwatch(); watch.Start(); var result = inner.TryInferConditions(obl, codefixesManager, out preConditions); watch.Stop(); inferenceTime += watch.Elapsed; if (preConditions == null) { return(false); } if (result) { inferred += preConditions.Count(); } return(result); }
public bool TryInferConditions(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredConditions preConditions) { preConditions = null; return(false); }
public CodeFixesProfiler(ICodeFixesManager inner, bool trace) { Contract.Requires(inner != null); this.inner = inner; this.trace = trace; }
public bool TryInferPrecondition(ProofObligation obl, ICodeFixesManager codefixesManager, out InferredPreconditions preConditions) { preConditions = (InferredPreconditions)null; return false; }