Exemple #1
0
        public RuleResult CheckMethod(MethodDefinition method)
        {
            if (method.Body == null)
            {
                return(RuleResult.DoesNotApply);
            }

            CFG cfg = new CFG(method);

            // requires -v -v
            if (Runner.VerbosityLevel > 0)
            {
                Trace.WriteLine(string.Empty);
                Trace.WriteLine("-------------------------------------");
                Trace.WriteLine(method.ToString());
                if (Runner.VerbosityLevel > 2)
                {
                    cfg.PrintDot();
                }
            }

            NonNullAttributeCollector nnaCollector = new NonNullAttributeCollector();
            NullDerefAnalysis         analysis     = new NullDerefAnalysis(method, nnaCollector, Runner);

            analysis.Verbose = Runner.VerbosityLevel > 1;

            Dataflow dataflow = new Dataflow(cfg, analysis);

            analysis.Verbose = Runner.VerbosityLevel > 1;
            dataflow.Compute();

            return(Runner.CurrentRuleResult);
        }
Exemple #2
0
		public RuleResult CheckMethod (MethodDefinition method)
		{
			if (method.Body == null)
				return RuleResult.DoesNotApply;

			CFG cfg = new CFG (method);

			// requires -v -v
			if (Runner.VerbosityLevel > 0) {
				Trace.WriteLine(string.Empty);
				Trace.WriteLine("-------------------------------------");
				Trace.WriteLine(method.ToString());
				if (Runner.VerbosityLevel > 2)
					cfg.PrintDot ();
			}

			NonNullAttributeCollector nnaCollector = new NonNullAttributeCollector();
			NullDerefAnalysis analysis = new NullDerefAnalysis (method, nnaCollector, Runner);
			analysis.Verbose = Runner.VerbosityLevel > 1;

			Dataflow dataflow = new Dataflow (cfg, analysis);
			analysis.Verbose = Runner.VerbosityLevel > 1;
			dataflow.Compute ();

			return Runner.CurrentRuleResult;
		}