Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
//
// AnalysisDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.AST;
using Mono.CodeContracts.Static.ControlFlow.Subroutines;
using Mono.CodeContracts.Static.Providers;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
abstract class AnalysisDriver<Expression, Variable>
: IBasicAnalysisDriver {
private readonly IBasicAnalysisDriver basic_driver;
protected AnalysisDriver (IBasicAnalysisDriver basicDriver)
{
this.basic_driver = basicDriver;
}
#region IBasicAnalysisDriver Members
public SubroutineFacade SubroutineFacade
{
get { return this.basic_driver.SubroutineFacade; }
}
public IMetaDataProvider MetaDataProvider
{
get { return this.basic_driver.MetaDataProvider; }
}
public IContractProvider ContractProvider
{
get { return this.basic_driver.ContractProvider; }
}
#endregion
public abstract IMethodDriver<Expression, Variable> CreateMethodDriver (Method method);
}
}

View File

@@ -0,0 +1,66 @@
//
// BasicAnalysisDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.AST;
using Mono.CodeContracts.Static.ControlFlow.Subroutines;
using Mono.CodeContracts.Static.Providers;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
class BasicAnalysisDriver : IBasicAnalysisDriver {
private readonly IContractProvider contract_provider;
private readonly IMetaDataProvider meta_data_provider;
#region Implementation of IBasicAnalysisDriver<Local,Parameter,Method,Field,Property,Event,Type,Attribute,Assembly>
public IMetaDataProvider MetaDataProvider
{
get { return this.meta_data_provider; }
}
public IContractProvider ContractProvider
{
get { return this.contract_provider; }
}
public SubroutineFacade SubroutineFacade { get; private set; }
#endregion
public BasicAnalysisDriver (IMetaDataProvider metaDataProvider,
IContractProvider contractProvider)
{
SubroutineFacade = new SubroutineFacade (metaDataProvider, contractProvider);
this.meta_data_provider = metaDataProvider;
this.contract_provider = contractProvider;
}
public BasicMethodDriver CreateMethodDriver (Method method)
{
return new BasicMethodDriver (method, this);
}
}
}

View File

@@ -0,0 +1,137 @@
//
// BasicMethodDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Mono.CodeContracts.Static.AST;
using Mono.CodeContracts.Static.Analysis.StackAnalysis;
using Mono.CodeContracts.Static.ControlFlow;
using Mono.CodeContracts.Static.DataStructures;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
class BasicMethodDriver {
private readonly Method method;
private readonly IBasicAnalysisDriver parent;
private ICFG contract_free_cfg;
private ICodeLayer<Dummy, Dummy, IMethodContextProvider, Dummy> contract_free_raw_layer;
private ICodeLayer<int, int, IStackContextProvider, Dummy> contract_free_stack_layer;
public BasicMethodDriver (Method method, IBasicAnalysisDriver parent)
{
this.method = method;
this.parent = parent;
RawLayer = CodeLayerFactory.Create (
this.parent.SubroutineFacade.GetControlFlowGraph (method).GetDecoder (parent.MetaDataProvider),
parent.MetaDataProvider,
parent.ContractProvider, dummy => "", dummy => "");
if (DebugOptions.Debug) {
Console.WriteLine ("-----APC based CFG-----");
RawLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print (Console.Out, RawLayer.Printer, null, null);
}
StackLayer = CodeLayerFactory.Create (
StackDepthFactory.Create (RawLayer.ILDecoder, RawLayer.MetaDataProvider),
RawLayer.MetaDataProvider,
RawLayer.ContractProvider, (i => "s" + i.ToString ()), i => "s" + i.ToString ()
);
if (DebugOptions.Debug)
{
Console.WriteLine ("-----Stack based CFG-----");
StackLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print (Console.Out, StackLayer.Printer, null, null);
}
}
public Method CurrentMethod
{
get { return this.method; }
}
public IBasicAnalysisDriver AnalysisDriver
{
get { return this.parent; }
}
public ICodeLayer<Dummy, Dummy, IMethodContextProvider, Dummy> RawLayer { get; private set; }
public ICodeLayer<int, int, IStackContextProvider, Dummy> StackLayer { get; private set; }
public ICodeLayer<Dummy, Dummy, IMethodContextProvider, Dummy> ContractFreeRawLayer
{
get
{
if (this.contract_free_raw_layer == null) {
this.contract_free_raw_layer =
CodeLayerFactory.Create (ContractFreeCFG.GetDecoder (this.parent.MetaDataProvider),
RawLayer.MetaDataProvider,
RawLayer.ContractProvider,
RawLayer.ExpressionToString, RawLayer.VariableToString, RawLayer.Printer);
}
return this.contract_free_raw_layer;
}
}
public ICodeLayer<int, int, IStackContextProvider, Dummy> ContractFreeStackLayer
{
get
{
if (this.contract_free_stack_layer == null) {
this.contract_free_stack_layer =
CodeLayerFactory.Create (StackDepthFactory.Create (ContractFreeRawLayer.ILDecoder, this.contract_free_raw_layer.MetaDataProvider),
ContractFreeRawLayer.MetaDataProvider,
ContractFreeRawLayer.ContractProvider,
StackLayer.ExpressionToString, StackLayer.VariableToString, StackLayer.Printer);
}
return this.contract_free_stack_layer;
}
}
public ICFG ContractFreeCFG
{
get
{
if (this.contract_free_cfg == null) {
this.contract_free_cfg = new ContractFilteredCFG (RawLayer.ILDecoder.ContextProvider.MethodContext.CFG);
if (DebugOptions.Debug)
{
Console.WriteLine ("------raw contract-free cfg -----------------");
this.contract_free_cfg.Print (Console.Out, RawLayer.Printer, null, null);
}
}
return this.contract_free_cfg;
}
}
public ICFG CFG
{
get { return StackLayer.ILDecoder.ContextProvider.MethodContext.CFG; }
}
}
}

View File

@@ -0,0 +1,175 @@
//
// CodeContractsAnalysisDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2012 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Mono.CodeContracts.Static.AST;
using Mono.CodeContracts.Static.Analysis.ExpressionAnalysis;
using Mono.CodeContracts.Static.Analysis.ExpressionAnalysis.Decoding;
using Mono.CodeContracts.Static.Analysis.HeapAnalysis;
using Mono.CodeContracts.Static.ControlFlow;
using Mono.CodeContracts.Static.DataStructures;
using Mono.CodeContracts.Static.Lattices;
using Mono.CodeContracts.Static.Providers;
using Mono.CodeContracts.Static.Proving;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
class CodeContractsAnalysisDriver<MethodResult>
: AnalysisDriver<LabeledSymbol<APC, SymbolicValue>, SymbolicValue> {
public CodeContractsAnalysisDriver (IBasicAnalysisDriver basicDriver)
: base (basicDriver)
{
}
public override IMethodDriver<LabeledSymbol<APC, SymbolicValue>, SymbolicValue> CreateMethodDriver (Method method)
{
return new MethodDriver (method, this);
}
#region Nested type: MethodDriver
private class MethodDriver : BasicMethodDriver,
IMethodDriver<LabeledSymbol<APC, SymbolicValue>, SymbolicValue>,
IFactBase<SymbolicValue> {
private Func<LabeledSymbol<APC, SymbolicValue>, string> expr2String;
private IFullExpressionDecoder<SymbolicValue, LabeledSymbol<APC, SymbolicValue>> expression_decoder;
private HeapAnalysis.HeapAnalysis heap_analysis;
public MethodDriver (Method method,
CodeContractsAnalysisDriver<MethodResult> parent)
: base (method, parent)
{
}
private new AnalysisDriver<LabeledSymbol<APC, SymbolicValue>, SymbolicValue> AnalysisDriver
{
get { return (AnalysisDriver<LabeledSymbol<APC, SymbolicValue>, SymbolicValue>) base.AnalysisDriver; }
}
#region IFactBase<SymbolicValue> Members
public FlatDomain<bool> IsNull (APC pc, SymbolicValue variable)
{
return ProofOutcome.Top;
}
public FlatDomain<bool> IsNonNull(APC pc, SymbolicValue variable)
{
return ProofOutcome.Top;
}
public bool IsUnreachable (APC pc)
{
return this.heap_analysis.IsUnreachable (pc);
}
#endregion
#region IMethodDriver<LabeledSymbol<APC,SymbolicValue>,SymbolicValue> Members
public ICodeLayer<SymbolicValue, SymbolicValue,
IValueContextProvider<SymbolicValue>,
IImmutableMap<SymbolicValue, Sequence<SymbolicValue>>> ValueLayer { get; private set; }
public ICodeLayer<LabeledSymbol<APC, SymbolicValue>, SymbolicValue,
IExpressionContextProvider<LabeledSymbol<APC, SymbolicValue>, SymbolicValue>,
IImmutableMap<SymbolicValue, Sequence<SymbolicValue>>> ExpressionLayer { get; private set; }
public ICodeLayer<SymbolicValue, SymbolicValue,
IValueContextProvider<SymbolicValue>,
IImmutableMap<SymbolicValue, Sequence<SymbolicValue>>> HybridLayer { get; private set; }
public IExpressionContextProvider<LabeledSymbol<APC, SymbolicValue>, SymbolicValue> ContextProvider
{
get { return ExpressionLayer.ILDecoder.ContextProvider; }
}
public IMetaDataProvider MetaDataProvider
{
get { return RawLayer.MetaDataProvider; }
}
public IFactBase<SymbolicValue> BasicFacts
{
get { return this; }
}
public IFullExpressionDecoder<SymbolicValue, LabeledSymbol<APC, SymbolicValue>> ExpressionDecoder
{
get
{
if (this.expression_decoder == null)
this.expression_decoder =
new FullExpressionDecoder<SymbolicValue, LabeledSymbol<APC, SymbolicValue>>(MetaDataProvider, ContextProvider);
return this.expression_decoder;
}
}
public void RunHeapAndExpressionAnalyses ()
{
if (this.heap_analysis != null)
return;
this.heap_analysis = new HeapAnalysis.HeapAnalysis (StackLayer);
StackLayer.CreateForward (this.heap_analysis) (this.heap_analysis.InitialValue ());
ValueLayer = CodeLayerFactory.Create (
this.heap_analysis.GetDecoder (StackLayer.ILDecoder), StackLayer.MetaDataProvider, StackLayer.ContractProvider,
source => source.ToString (), dest => dest.ToString ());
var expressionAnalysis = new ExpressionAnalysisFacade<SymbolicValue, IValueContextProvider<SymbolicValue>, IImmutableMap<SymbolicValue, Sequence<SymbolicValue>>>
(ValueLayer, this.heap_analysis.IsUnreachable);
ValueLayer.CreateForward (expressionAnalysis.CreateExpressionAnalysis ()) (expressionAnalysis.InitialValue (SymbolicValue.GetUniqueKey));
if (DebugOptions.Debug)
{
Console.WriteLine ("------------Value based CFG-----------------");
ValueLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print (Console.Out, ValueLayer.Printer, null, null);
}
IILDecoder
<APC, LabeledSymbol<APC, SymbolicValue>, SymbolicValue, IExpressionContextProvider<LabeledSymbol<APC, SymbolicValue>, SymbolicValue>, IImmutableMap<SymbolicValue, Sequence<SymbolicValue>>>
decoder = expressionAnalysis.GetDecoder (ValueLayer.ILDecoder);
this.expr2String = ExpressionPrinterFactory.Printer (decoder.ContextProvider, this);
ExpressionLayer = CodeLayerFactory.Create (decoder, ValueLayer.MetaDataProvider, ValueLayer.ContractProvider,
this.expr2String, ValueLayer.VariableToString);
if (DebugOptions.Debug)
{
Console.WriteLine ("------------Expression based CFG-------------");
ExpressionLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print (Console.Out, ExpressionLayer.Printer, null, null);
}
HybridLayer = CodeLayerFactory.Create (ValueLayer.ILDecoder, ValueLayer.MetaDataProvider, ValueLayer.ContractProvider,
ValueLayer.ExpressionToString,
ValueLayer.VariableToString, ExpressionLayer.Printer);
}
public int KeyConverter (SymbolicValue var)
{
return SymbolicValue.GetUniqueKey (var);
}
#endregion
}
#endregion
}
}

View File

@@ -0,0 +1,38 @@
//
// IBasicAnalysisDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.ControlFlow.Subroutines;
using Mono.CodeContracts.Static.Providers;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IBasicAnalysisDriver {
SubroutineFacade SubroutineFacade { get; }
IMetaDataProvider MetaDataProvider { get; }
IContractProvider ContractProvider { get; }
}
}

View File

@@ -0,0 +1,42 @@
//
// IBasicMethodDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.ControlFlow;
using Mono.CodeContracts.Static.DataStructures;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IBasicMethodDriver {
ICodeLayer<Dummy, Dummy, IMethodContextProvider, Dummy> RawLayer { get; }
ICodeLayer<int, int, IStackContextProvider, Dummy> StackLayer { get; }
ICodeLayer<Dummy, Dummy, IMethodContextProvider, Dummy> ContractFreeRawLayer { get; }
ICodeLayer<int, int, IStackContextProvider, Dummy> ContractFreeStackLayer { get; }
ICFG ContractFreeCFG { get; }
IBasicAnalysisDriver AnalysisDriver { get; }
}
}

View File

@@ -0,0 +1,40 @@
//
// IMethodAnalysis.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IMethodAnalysis {
string Name { get; }
IMethodResult<Variable> Analyze<Expression, Variable> (
string fullMethodName, IMethodDriver<Expression, Variable> methodDriver)
where Variable : IEquatable<Variable>
where Expression : IEquatable<Expression>;
}
}

View File

@@ -0,0 +1,38 @@
//
// IMethodAnalysisFixPoint.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.ControlFlow;
using Mono.CodeContracts.Static.Lattices;
using Mono.CodeContracts.Static.Proving;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IMethodAnalysisFixPoint<Variable> {
IFactQuery<BoxedExpression, Variable> FactQuery { get; }
FlatDomain<bool> ValidateExplicitAssertion (APC pc, Variable value);
}
}

View File

@@ -0,0 +1,53 @@
//
// IMethodDriver.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using Mono.CodeContracts.Static.AST;
using Mono.CodeContracts.Static.Analysis.ExpressionAnalysis.Decoding;
using Mono.CodeContracts.Static.ControlFlow;
using Mono.CodeContracts.Static.DataStructures;
using Mono.CodeContracts.Static.Providers;
using Mono.CodeContracts.Static.Proving;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IMethodDriver<Expression, Variable> : IBasicMethodDriver {
ICodeLayer<Variable, Variable, IValueContextProvider<Variable>, IImmutableMap<Variable, Sequence<Variable>>> ValueLayer { get; }
ICodeLayer<Expression, Variable, IExpressionContextProvider<Expression, Variable>, IImmutableMap<Variable, Sequence<Variable>>> ExpressionLayer { get; }
ICodeLayer<Variable, Variable, IValueContextProvider<Variable>, IImmutableMap<Variable, Sequence<Variable>>> HybridLayer { get; }
IExpressionContextProvider<Expression, Variable> ContextProvider { get; }
IMetaDataProvider MetaDataProvider { get; }
ICFG CFG { get; }
Method CurrentMethod { get; }
IFactBase<Variable> BasicFacts { get; }
IFullExpressionDecoder<Variable, Expression> ExpressionDecoder { get; }
void RunHeapAndExpressionAnalyses ();
int KeyConverter (Variable var);
}
}

View File

@@ -0,0 +1,37 @@
//
// IMethodResult.cs
//
// Authors:
// Alexander Chebaturkin (chebaturkin@gmail.com)
//
// Copyright (C) 2011 Alexander Chebaturkin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Generic;
using Mono.CodeContracts.Static.Proving;
namespace Mono.CodeContracts.Static.Analysis.Drivers {
interface IMethodResult<Variable> : IMethodAnalysisFixPoint<Variable> {
IMethodAnalysis MethodAnalysis { get; set; }
void ValidateImplicitAssertions (IFactQuery<BoxedExpression, Variable> facts, List<string> proofResults);
}
}