Пример #1
0
        protected override void LanguageSpecificAnalysis(Method method)
        {
            if (!this.CodeIsWellFormed)
            {
                return;
            }
            if (Cci.Analyzer.Debug)
            {
                ControlFlowGraph cfg = GetCFG(method);
                if (cfg != null)
                {
                    cfg.Display(Console.Out);
                }
            }
            if (method.Name.Name.StartsWith("Microsoft.Contracts"))
            {
                return;
            }
            // Weak Purity and Effects Analysis
            if (this.WeakPurityAnalysis && this.WeakPurityAnalyzer != null)
            {
                this.WeakPurityAnalyzer.VisitMethod(method); // computes points-to and effects
                // processes results from VisitMethod: issues errors and potentially prints out detailed info.
                this.WeakPurityAnalyzer.ProcessResultsMethod(method);

                // Admissibility Check
                PointsToAndWriteEffects ptwe = this.WeakPurityAnalyzer.GetPurityAnalysisWithDefault(method);
                if (method.IsConfined || method.IsStateIndependent)
                {
                    Microsoft.SpecSharp.ReadEffectAdmissibilityChecker reac = new Microsoft.SpecSharp.ReadEffectAdmissibilityChecker(method, typeSystem.ErrorHandler);
                    reac.CheckReadEffectAdmissibility(ptwe.ComputeEffects(ptwe.ReadEffects));
                }
            }

            if (ReentrancyAnalysis)
            {
                if (this.ReentrancyAnalyzer != null)
                {
                    this.ReentrancyAnalyzer.VisitMethod(method);
                }
            }

            if (ObjectExposureAnalysis)
            {
                if (this.ObjectExposureAnalyzer != null)
                {
                    this.ObjectExposureAnalyzer.VisitMethod(method);
                }
            }
        }
Пример #2
0
        protected override void LanguageSpecificAnalysis(Method method)
        {
            if (!this.CodeIsWellFormed)
                return;
            if (Cci.Analyzer.Debug)
            {
                ControlFlowGraph cfg = GetCFG(method);
                if (cfg != null) cfg.Display(Console.Out);
            }
            if (method.Name.Name.StartsWith("Microsoft.Contracts"))
                return;
            // Weak Purity and Effects Analysis
            if (this.WeakPurityAnalysis && this.WeakPurityAnalyzer != null)
            {
                this.WeakPurityAnalyzer.VisitMethod(method); // computes points-to and effects
                // processes results from VisitMethod: issues errors and potentially prints out detailed info.
                this.WeakPurityAnalyzer.ProcessResultsMethod(method);

                // Admissibility Check 
                PointsToAndWriteEffects ptwe = this.WeakPurityAnalyzer.GetPurityAnalysisWithDefault(method);
                if (method.IsConfined || method.IsStateIndependent)
                {
                    Microsoft.SpecSharp.ReadEffectAdmissibilityChecker reac = new Microsoft.SpecSharp.ReadEffectAdmissibilityChecker(method, typeSystem.ErrorHandler);
                    reac.CheckReadEffectAdmissibility(ptwe.ComputeEffects(ptwe.ReadEffects));
                }

            }

            if (ReentrancyAnalysis)
            {
                if (this.ReentrancyAnalyzer != null)
                {
                    this.ReentrancyAnalyzer.VisitMethod(method);
                }
            }

            if (ObjectExposureAnalysis)
            {
                if (this.ObjectExposureAnalyzer != null)
                {
                    this.ObjectExposureAnalyzer.VisitMethod(method);
                }
            }
        }