public override T Instantiate <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, T> ( string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver, Predicate <APC> cachePCs, IMethodAnalysisClientFactory <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, T> factory, DFAController controller ) { var numericalAnalysis = new AnalysisWrapper.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> . NumericalAnalysis <Bounds.BoundsOptions>(methodName, mdriver, this.boundsOptions, cachePCs, controller); var nonnullAnalysis = this.nonnullAnalysis != null ? new Analyzers.NonNull.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> . AnalysisForArrays(mdriver, this.nonnullAnalysis, cachePCs) : null; var arrayAnalysis = new AnalysisWrapper.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> . ArrayAnalysisPlugIn(methodName, mdriver, this.options[0].LogOptions, cachePCs); var analysis = new AnalysisWrapper.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> . ArrayAnalysis <Analyzers.Arrays.ArrayOptions, Bounds.BoundsOptions>(methodName, arrayAnalysis, numericalAnalysis, nonnullAnalysis, this.IsEnumAnalysisSelected, mdriver, this.options[0], cachePCs); return(factory.Create(analysis, controller)); }
public override IProofObligations <Variable, BoxedExpression> GetProofObligations <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> ( string fullMethodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver ) { var obl = new ProofObligationComposition <Variable, BoxedExpression>(); if (!this.boundsOptions[0].NoProofObligations) { var numObl = new AnalysisWrapper.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .BoundsObligations(mdriver, this.boundsOptions[0].NoProofObligations); obl.Add(numObl); } if (this.nonnullAnalysis != null) { var nnObl = this.nonnullAnalysis.GetProofObligations(fullMethodName, mdriver); if (nnObl != null) { obl.Add(nnObl); } } if (this.IsEnumAnalysisSelected) { obl.Add(new AnalysisWrapper.TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .EnumObligations(mdriver, false)); } return(obl); }
public static Func <LabeledSymbol <APC, SymbolicValue>, string> Printer <SymbolicValue> (IExpressionContextProvider <LabeledSymbol <APC, SymbolicValue>, SymbolicValue> contextProvider, IMethodDriver <LabeledSymbol <APC, SymbolicValue>, SymbolicValue> methodDriver) where SymbolicValue : IEquatable <SymbolicValue> { return(new PrinterImpl <SymbolicValue> (contextProvider, methodDriver).PrintAt); }
public IMethodResult <TVar> Analyze <TExpr, TVar> (string fullMethodName, IMethodDriver <TExpr, TVar> methodDriver) where TVar : IEquatable <TVar> where TExpr : IEquatable <TExpr> { return(AnalysisFacade.RunArithmeticAnalysis(fullMethodName, methodDriver)); }
internal StringValueAnalysis( string methodName, IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> methodDriver, IValueAnalysisOptions options) : base(methodName, methodDriver, options) { }
public ArrayAnalysisBasePlugIn(int id, string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver, ILogOptions options, Predicate <APC> cachePCs) : base(id, methodName, driver, new PlugInAnalysisOptions(options), cachePCs) { }
private static ProofOutcome ProcessOutcome <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions> ( FlatAbstractDomain <bool> result, BoxedExpression exp, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions> mdriver, out BoxedExpression simplified ) where Expression : IEquatable <Expression> where Variable : IEquatable <Variable> where LogOptions : IFrameworkLogOptions where Type : IEquatable <Type> { if (result.IsTrue()) { simplified = BoxedExpression.Const(1, mdriver.MetaDataDecoder.System_Boolean, mdriver.MetaDataDecoder); return(ProofOutcome.True); } if (result.IsFalse()) { simplified = BoxedExpression.Const(0, mdriver.MetaDataDecoder.System_Boolean, mdriver.MetaDataDecoder); return(ProofOutcome.False); } simplified = exp; return(ProofOutcome.Top); }
public MarkersFetcherAnalysis( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver) { Contract.Requires(mdriver != null); this.mDriver = mdriver; }
RunDisjunctionRecoveryAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> ( string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver, Predicate <APC> cachePCs ) where Variable : IEquatable <Variable> where Expression : IEquatable <Expression> where Type : IEquatable <Type> { Contract.Requires(driver != null); var analysis = new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .DisjunctionsRecoveryAnalysis (methodName, driver, cachePCs); var closure = driver.HybridLayer.CreateForward <TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .DisjunctiveRefinement>( analysis, new DFAOptions { Trace = driver.Options.TraceDFA, Timeout = driver.Options.Timeout, EnforceFairJoin = driver.Options.EnforceFairJoin, IterationsBeforeWidening = driver.Options.IterationsBeforeWidening, TraceTimePerInstruction = driver.Options.TraceTimings, TraceMemoryPerInstruction = driver.Options.TraceMemoryConsumption }); closure(analysis.GetTopValue()); // Do the analysis analysis.ClearCaches(); return(new SyntacticInformation <Method, Field, Variable>(analysis, analysis.Tests, analysis.RightExpressions, analysis.FirstViewAt, analysis.MayUpdateFields, analysis.MethodCalls, analysis.liveVariablesInRenamings, analysis.RenamingsLength, analysis.HasThrow, analysis.HasExceptionHandlers)); }
public ContractDensity DoIt( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver) { base.Run(driver.RawLayer); return(new ContractDensity(this.methodInstructions, this.contractInstructions, this.contracts)); }
public SyntacticComplexity DoIt( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver) { base.Run(driver.RawLayer); return(new SyntacticComplexity(this.joinpoints, this.instructions, this.loops)); }
internal static ContractDensity GetContractDensity( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver) { var analysis = new DensityAnalysis(); return(analysis.DoIt(driver)); }
/// <summary> /// Computes a table of (access path, symbolic value) tuples at the given program point. /// /// The method hard codes our choice of which access pathes are considered "important". /// Currently, fields of the iterator class and the length of the array, if the field is /// an array. TODO: consult Francesco to see what we can do to improve the accuracy. /// </summary> /// <param name="pc"></param> /// <param name="driver"></param> /// <returns></returns> public IEnumerable <Pair <string, Variable> > SymbolicValuesAt (APC pc, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver) { Variable thisV; var context = driver.Context; var mdDecoder = driver.MetaDataDecoder; if (!context.ValueContext.TryParameterValue(pc, mdDecoder.This(context.MethodContext.CurrentMethod), out thisV)) { yield break; } Type currentType = mdDecoder.DeclaringType(context.MethodContext.CurrentMethod); foreach (Field f in mdDecoder.Fields(currentType)) { Variable fieldAddr; if (context.ValueContext.TryFieldAddress(pc, thisV, f, out fieldAddr)) { Variable v; if (context.ValueContext.TryLoadIndirect(pc, fieldAddr, out v)) { Type fieldType = mdDecoder.FieldType(f); if (fieldType != null && mdDecoder.IsArray(fieldType)) { Variable arrayLength; if (context.ValueContext.TryGetArrayLength(pc, v, out arrayLength)) { yield return(new Pair <string, Variable>(mdDecoder.Name(f) + ".Length", arrayLength)); } } yield return(new Pair <string, Variable>(mdDecoder.Name(f), v)); } } } }
public GenericNumericalAnalysis(string methodName, IMethodDriver <TExpr, TVar> methodDriver, Analysers.ArithmeticEnvironmentKind envKind) : base(methodName, methodDriver) { env_kind = envKind; }
public AddExplicitCastToTheExpression(IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variabl, LogOptions> mDriver) { Contract.Requires(mDriver != null); this.MethodDriver = mDriver; this.castTo = this.MethodDriver.MetaDataDecoder.DeclaringType(this.MethodDriver.CurrentMethod); }
abstract public IProofObligations <Variable, BoxedExpression> GetProofObligations <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> ( string fullMethodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver ) where Type : IEquatable <Type> where Expression : IEquatable <Expression> where Variable : IEquatable <Variable>;
private static IEnumerable <AssertionObligation> GetAssertions(IMethodDriver <TExpression, TVariable> driver, out object assertStats) { var analysis = new AssertionCrawlerAnalysis(); List <AssertionObligation> obligations = analysis.Gather(driver); assertStats = null; return(obligations); }
abstract public IMethodResult <Variable> Analyze <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>( string fullMethodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver, Predicate <APC> cachePCs ) where Type : IEquatable <Type> where Expression : IEquatable <Expression> where Variable : IEquatable <Variable>;
public int SuggestCodeFixes <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Exp, Variable, ILogOptions>( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, ExternalExpression <APC, Variable>, Variable, ILogOptions> mdriver) where Variable : IEquatable <Variable> where Type : IEquatable <Type> where ILogOptions : IFrameworkLogOptions { return(0); }
public static IMethodResult <TVar> RunArithmeticAnalysis <TVar, TExpr> (string methodName, IMethodDriver <TExpr, TVar> methodDriver) where TVar : IEquatable <TVar> where TExpr : IEquatable <TExpr> { return(Bind <TVar, TExpr> .RunArithmeticAnalysis(methodName, methodDriver)); }
Analyze <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable>( string fullMethodName, IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver) where Variable : IEquatable <Variable> where Expression : IEquatable <Expression> where Type : IEquatable <Type> { return(AnalysisWrapper.AnalyzeStrings(fullMethodName, mdriver, options)); }
public LocallocObligation(APC pc, BoxedExpression size, BoxedExpressionDecoder <Variable> decoder, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver ) : base(pc, decoder, mdriver, null) { Contract.Requires(size != null); this.size = size; }
public PentagonUnsafeCodeAnalysis( string methodName, IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> mdriver, List <Analyzers.Unsafe.UnsafeOptions> options, IOverallUnsafeStatistics overallStats ) : base(methodName, mdriver, options, overallStats) { }
public static ContractDensity GetContractDensity <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>( IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver ) where Expression : IEquatable <Expression> where Variable : IEquatable <Variable> where Type : IEquatable <Type> { return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .GetContractDensity(driver)); }
public EnumAnalysis( string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver, Analyzers.Enum.Options options, Predicate <APC> cachePCs ) : base(methodName, driver, options, cachePCs) { }
public static EnumerableClassInfo <Method, Parameter> SeekEnumerableClass(IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> methodDriver) { EnumerableHelper <Local, Parameter, Method, Field, Property, Type, Variable, Attribute, Assembly, Expression, ILogOptions> helper = new EnumerableHelper <Local, Parameter, Method, Field, Property, Type, Variable, Attribute, Assembly, Expression, ILogOptions>(methodDriver); Domain initVal = new Domain(); methodDriver.CreateForward(helper)(initVal); return(helper.ToBeAnalyzed); }
public Refiner(APC pc, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions> mdriver) { Contract.Requires(mdriver != null); this.mdriver = mdriver; this.subroutine = pc.Block.Subroutine; Contract.Assert(mdriver.MetaDataDecoder != null); this.False = BoxedExpression.ConstBool(0, mdriver.MetaDataDecoder); }
internal StringValueAnalysis( string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> methodDriver, IValueAnalysisOptions options, Predicate <APC> cachePCs ) : base(methodName, methodDriver, options, cachePCs) { }
abstract public T Instantiate <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, T>( string fullMethodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver, Predicate <APC> cachePCs, IMethodAnalysisClientFactory <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, T> factory ) where Variable : IEquatable <Variable> where Expression : IEquatable <Expression> where Type : IEquatable <Type>;
public EnumAnalysisWrapperPlugIn(EnumAnalysis enumAnalysis, int id, string methodName, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver, ILogOptions options, Predicate <APC> cachePCs) : base(id, methodName, mdriver, new PlugInAnalysisOptions(options), cachePCs) { Contract.Requires(enumAnalysis != null); this.enumAnalysis = enumAnalysis; }