Example #1
0
        public static ImmutableDictionary <IParameterSymbol, SyntaxNode> GetOrComputeHazardousParameterUsages(
            IBlockOperation topmostBlock,
            Compilation compilation,
            ISymbol owningSymbol,
            AnalyzerOptions analyzerOptions,
            DiagnosticDescriptor rule,
            CancellationToken cancellationToken,
            InterproceduralAnalysisKind interproceduralAnalysisKind = InterproceduralAnalysisKind.ContextSensitive,
            uint defaultMaxInterproceduralMethodCallChain           = 1, // By default, we only want to track method calls one level down.
            bool pessimisticAnalysis = true)
        {
            var interproceduralAnalysisConfig = InterproceduralAnalysisConfiguration.Create(
                analyzerOptions, rule, interproceduralAnalysisKind, cancellationToken, defaultMaxInterproceduralMethodCallChain);
            var performCopyAnalysis        = analyzerOptions.GetCopyAnalysisOption(rule, defaultValue: false, cancellationToken);
            var nullCheckValidationMethods = analyzerOptions.GetSeparatedStringOptionValue(
                EditorConfigOptionNames.NullCheckValidationMethods,
                rule,
                cancellationToken);

            return(GetOrComputeHazardousParameterUsages(topmostBlock, compilation, owningSymbol,
                                                        nullCheckValidationMethods, interproceduralAnalysisConfig, performCopyAnalysis, pessimisticAnalysis));
        }