Beispiel #1
0
        protected AbstractDataFlowAnalysisContext(
            AbstractValueDomain <TAbstractAnalysisValue> valueDomain,
            WellKnownTypeProvider wellKnownTypeProvider,
            ControlFlowGraph controlFlowGraph,
            ISymbol owningSymbol,
            AnalyzerOptions analyzerOptions,
            InterproceduralAnalysisConfiguration interproceduralAnalysisConfig,
            bool pessimisticAnalysis,
            bool predicateAnalysis,
            bool exceptionPathsAnalysis,
            CopyAnalysisResult copyAnalysisResultOpt,
            PointsToAnalysisResult pointsToAnalysisResultOpt,
            ValueContentAnalysisResult valueContentAnalysisResultOpt,
            Func <TAnalysisContext, TAnalysisResult> tryGetOrComputeAnalysisResult,
            ControlFlowGraph parentControlFlowGraphOpt,
            InterproceduralAnalysisData <TAnalysisData, TAnalysisContext, TAbstractAnalysisValue> interproceduralAnalysisDataOpt,
            InterproceduralAnalysisPredicate interproceduralAnalysisPredicateOpt)
        {
            Debug.Assert(valueDomain != null, "valueDomain must not be null for use in ComputeHashCodeParts");
            Debug.Assert(controlFlowGraph != null);
            Debug.Assert(owningSymbol != null);
            Debug.Assert(owningSymbol.Kind == SymbolKind.Method ||
                         owningSymbol.Kind == SymbolKind.Field ||
                         owningSymbol.Kind == SymbolKind.Property ||
                         owningSymbol.Kind == SymbolKind.Event);
            Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol));
            Debug.Assert(wellKnownTypeProvider != null);
            Debug.Assert(tryGetOrComputeAnalysisResult != null);
            Debug.Assert(pointsToAnalysisResultOpt == null ||
                         pointsToAnalysisResultOpt.ControlFlowGraph == controlFlowGraph);
            Debug.Assert(copyAnalysisResultOpt == null ||
                         copyAnalysisResultOpt.ControlFlowGraph == controlFlowGraph);
            Debug.Assert(valueContentAnalysisResultOpt == null ||
                         valueContentAnalysisResultOpt.ControlFlowGraph == controlFlowGraph);

            ValueDomain                          = valueDomain;
            WellKnownTypeProvider                = wellKnownTypeProvider;
            ControlFlowGraph                     = controlFlowGraph;
            ParentControlFlowGraphOpt            = parentControlFlowGraphOpt;
            OwningSymbol                         = owningSymbol;
            AnalyzerOptions                      = analyzerOptions;
            InterproceduralAnalysisConfiguration = interproceduralAnalysisConfig;
            PessimisticAnalysis                  = pessimisticAnalysis;
            PredicateAnalysis                    = predicateAnalysis;
            ExceptionPathsAnalysis               = exceptionPathsAnalysis;
            CopyAnalysisResultOpt                = copyAnalysisResultOpt;
            PointsToAnalysisResultOpt            = pointsToAnalysisResultOpt;
            ValueContentAnalysisResultOpt        = valueContentAnalysisResultOpt;
            TryGetOrComputeAnalysisResult        = tryGetOrComputeAnalysisResult;
            InterproceduralAnalysisDataOpt       = interproceduralAnalysisDataOpt;
            InterproceduralAnalysisPredicateOpt  = interproceduralAnalysisPredicateOpt;
        }
Beispiel #2
0
 protected sealed override void ComputeHashCodeParts(ArrayBuilder <int> builder)
 {
     builder.Add(ValueDomain.GetHashCode());
     builder.Add(OwningSymbol.GetHashCode());
     builder.Add(ControlFlowGraph.OriginalOperation.GetHashCode());
     builder.Add(InterproceduralAnalysisConfiguration.GetHashCode());
     builder.Add(PessimisticAnalysis.GetHashCode());
     builder.Add(PredicateAnalysis.GetHashCode());
     builder.Add(ExceptionPathsAnalysis.GetHashCode());
     builder.Add(CopyAnalysisResultOpt.GetHashCodeOrDefault());
     builder.Add(PointsToAnalysisResultOpt.GetHashCodeOrDefault());
     builder.Add(InterproceduralAnalysisDataOpt.GetHashCodeOrDefault());
     builder.Add(InterproceduralAnalysisPredicateOpt.GetHashCodeOrDefault());
     ComputeHashCodePartsSpecific(builder);
 }
Beispiel #3
0
        protected AbstractDataFlowAnalysisContext(
            AbstractValueDomain <TAbstractAnalysisValue> valueDomain,
            WellKnownTypeProvider wellKnownTypeProvider,
            ControlFlowGraph controlFlowGraph,
            ISymbol owningSymbol,
            AnalyzerOptions analyzerOptions,
            InterproceduralAnalysisConfiguration interproceduralAnalysisConfig,
            bool pessimisticAnalysis,
            bool predicateAnalysis,
            bool exceptionPathsAnalysis,
            CopyAnalysisResult?copyAnalysisResult,
            PointsToAnalysisResult?pointsToAnalysisResult,
            ValueContentAnalysisResult?valueContentAnalysisResult,
            Func <TAnalysisContext, TAnalysisResult?> tryGetOrComputeAnalysisResult,
            ControlFlowGraph?parentControlFlowGraph,
            InterproceduralAnalysisData <TAnalysisData, TAnalysisContext, TAbstractAnalysisValue>?interproceduralAnalysisData,
            InterproceduralAnalysisPredicate?interproceduralAnalysisPredicate)
        {
            Debug.Assert(owningSymbol.Kind == SymbolKind.Method ||
                         owningSymbol.Kind == SymbolKind.Field ||
                         owningSymbol.Kind == SymbolKind.Property ||
                         owningSymbol.Kind == SymbolKind.Event);
            Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol));
            Debug.Assert(pointsToAnalysisResult == null ||
                         pointsToAnalysisResult.ControlFlowGraph == controlFlowGraph);
            Debug.Assert(copyAnalysisResult == null ||
                         copyAnalysisResult.ControlFlowGraph == controlFlowGraph);
            Debug.Assert(valueContentAnalysisResult == null ||
                         valueContentAnalysisResult.ControlFlowGraph == controlFlowGraph);

            ValueDomain            = valueDomain;
            WellKnownTypeProvider  = wellKnownTypeProvider;
            ControlFlowGraph       = controlFlowGraph;
            ParentControlFlowGraph = parentControlFlowGraph;
            OwningSymbol           = owningSymbol;
            AnalyzerOptions        = analyzerOptions;
            InterproceduralAnalysisConfiguration = interproceduralAnalysisConfig;
            PessimisticAnalysis              = pessimisticAnalysis;
            PredicateAnalysis                = predicateAnalysis;
            ExceptionPathsAnalysis           = exceptionPathsAnalysis;
            CopyAnalysisResult               = copyAnalysisResult;
            PointsToAnalysisResult           = pointsToAnalysisResult;
            ValueContentAnalysisResult       = valueContentAnalysisResult;
            TryGetOrComputeAnalysisResult    = tryGetOrComputeAnalysisResult;
            InterproceduralAnalysisData      = interproceduralAnalysisData;
            InterproceduralAnalysisPredicate = interproceduralAnalysisPredicate;
        }
Beispiel #4
0
 protected sealed override void ComputeHashCodeParts(Action <int> addPart)
 {
     addPart(ValueDomain.GetHashCode());
     addPart(OwningSymbol.GetHashCode());
     addPart(ControlFlowGraph.OriginalOperation.GetHashCode());
     addPart(AnalyzerOptions.GetHashCode());
     addPart(InterproceduralAnalysisConfiguration.GetHashCode());
     addPart(PessimisticAnalysis.GetHashCode());
     addPart(PredicateAnalysis.GetHashCode());
     addPart(ExceptionPathsAnalysis.GetHashCode());
     addPart(CopyAnalysisResultOpt.GetHashCodeOrDefault());
     addPart(PointsToAnalysisResultOpt.GetHashCodeOrDefault());
     addPart(ValueContentAnalysisResultOpt.GetHashCodeOrDefault());
     addPart(InterproceduralAnalysisDataOpt.GetHashCodeOrDefault());
     addPart(InterproceduralAnalysisPredicateOpt.GetHashCodeOrDefault());
     ComputeHashCodePartsSpecific(addPart);
 }
 protected sealed override void ComputeHashCodeParts(ref RoslynHashCode hashCode)
 {
     hashCode.Add(ValueDomain.GetHashCode());
     hashCode.Add(OwningSymbol.GetHashCode());
     hashCode.Add(ControlFlowGraph.GetHashCode());
     hashCode.Add(AnalyzerOptions.GetHashCode());
     hashCode.Add(InterproceduralAnalysisConfiguration.GetHashCode());
     hashCode.Add(PessimisticAnalysis.GetHashCode());
     hashCode.Add(PredicateAnalysis.GetHashCode());
     hashCode.Add(ExceptionPathsAnalysis.GetHashCode());
     hashCode.Add(CopyAnalysisResult.GetHashCodeOrDefault());
     hashCode.Add(PointsToAnalysisResult.GetHashCodeOrDefault());
     hashCode.Add(ValueContentAnalysisResult.GetHashCodeOrDefault());
     hashCode.Add(InterproceduralAnalysisData.GetHashCodeOrDefault());
     hashCode.Add(InterproceduralAnalysisPredicate.GetHashCodeOrDefault());
     ComputeHashCodePartsSpecific(ref hashCode);
 }
        protected sealed override bool ComputeEqualsByHashCodeParts(CacheBasedEquatable <TAnalysisContext> obj)
        {
            var other = (AbstractDataFlowAnalysisContext <TAnalysisData, TAnalysisContext, TAnalysisResult, TAbstractAnalysisValue>)obj;

            return(ValueDomain.GetHashCode() == other.ValueDomain.GetHashCode() &&
                   OwningSymbol.GetHashCode() == other.OwningSymbol.GetHashCode() &&
                   ControlFlowGraph.GetHashCode() == other.ControlFlowGraph.GetHashCode() &&
                   AnalyzerOptions.GetHashCode() == other.AnalyzerOptions.GetHashCode() &&
                   InterproceduralAnalysisConfiguration.GetHashCode() == other.InterproceduralAnalysisConfiguration.GetHashCode() &&
                   PessimisticAnalysis.GetHashCode() == other.PessimisticAnalysis.GetHashCode() &&
                   PredicateAnalysis.GetHashCode() == other.PredicateAnalysis.GetHashCode() &&
                   ExceptionPathsAnalysis.GetHashCode() == other.ExceptionPathsAnalysis.GetHashCode() &&
                   CopyAnalysisResult.GetHashCodeOrDefault() == other.CopyAnalysisResult.GetHashCodeOrDefault() &&
                   PointsToAnalysisResult.GetHashCodeOrDefault() == other.PointsToAnalysisResult.GetHashCodeOrDefault() &&
                   ValueContentAnalysisResult.GetHashCodeOrDefault() == other.ValueContentAnalysisResult.GetHashCodeOrDefault() &&
                   InterproceduralAnalysisData.GetHashCodeOrDefault() == other.InterproceduralAnalysisData.GetHashCodeOrDefault() &&
                   InterproceduralAnalysisPredicate.GetHashCodeOrDefault() == other.InterproceduralAnalysisPredicate.GetHashCodeOrDefault() &&
                   ComputeEqualsByHashCodeParts(other));
        }
Beispiel #7
0
        protected AbstractDataFlowAnalysisContext(
            AbstractValueDomain <TAbstractAnalysisValue> valueDomain,
            WellKnownTypeProvider wellKnownTypeProvider,
            ControlFlowGraph controlFlowGraph,
            ISymbol owningSymbol,
            InterproceduralAnalysisConfiguration interproceduralAnalysisConfig,
            bool pessimisticAnalysis,
            bool predicateAnalysis,
            bool exceptionPathsAnalysis,
            CopyAnalysisResult copyAnalysisResultOpt,
            PointsToAnalysisResult pointsToAnalysisResultOpt,
            Func <TAnalysisContext, TAnalysisResult> getOrComputeAnalysisResult,
            ControlFlowGraph parentControlFlowGraphOpt,
            InterproceduralAnalysisData <TAnalysisData, TAnalysisContext, TAbstractAnalysisValue> interproceduralAnalysisDataOpt,
            InterproceduralAnalysisPredicate interproceduralAnalysisPredicateOpt)
        {
            Debug.Assert(controlFlowGraph != null);
            Debug.Assert(owningSymbol != null);
            Debug.Assert(owningSymbol.Kind == SymbolKind.Method ||
                         owningSymbol.Kind == SymbolKind.Field ||
                         owningSymbol.Kind == SymbolKind.Property ||
                         owningSymbol.Kind == SymbolKind.Event);
            Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol));
            Debug.Assert(wellKnownTypeProvider != null);
            Debug.Assert(getOrComputeAnalysisResult != null);

            ValueDomain                          = valueDomain;
            WellKnownTypeProvider                = wellKnownTypeProvider;
            ControlFlowGraph                     = controlFlowGraph;
            ParentControlFlowGraphOpt            = parentControlFlowGraphOpt;
            OwningSymbol                         = owningSymbol;
            InterproceduralAnalysisConfiguration = interproceduralAnalysisConfig;
            PessimisticAnalysis                  = pessimisticAnalysis;
            PredicateAnalysis                    = predicateAnalysis;
            ExceptionPathsAnalysis               = exceptionPathsAnalysis;
            CopyAnalysisResultOpt                = copyAnalysisResultOpt;
            PointsToAnalysisResultOpt            = pointsToAnalysisResultOpt;
            GetOrComputeAnalysisResult           = getOrComputeAnalysisResult;
            InterproceduralAnalysisDataOpt       = interproceduralAnalysisDataOpt;
            InterproceduralAnalysisPredicateOpt  = interproceduralAnalysisPredicateOpt;
        }