/// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dfg">DataFlowGraph</param>
 internal TaintTrackingAnalysis(IGraph<IDataFlowNode> dfg)
 {
     this.AnalysisContext = dfg.EntryNode.Summary.AnalysisContext;
     this.SemanticModel = dfg.EntryNode.Summary.SemanticModel;
     this.Summary = dfg.EntryNode.Summary;
     this.DataFlowGraph = dfg;
 }
Beispiel #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dfgNode">DataFlowNode</param>
 /// <param name="context">AnalysisContext</param>
 internal DataFlowInfo(DataFlowNode dfgNode, AnalysisContext context)
 {
     this.AnalysisContext = context;
     this.DataFlowNode = dfgNode;
     this.GeneratedDefinitions = new HashSet<SymbolDefinition>();
     this.KilledDefinitions = new HashSet<SymbolDefinition>();
     this.InputDefinitions = new HashSet<SymbolDefinition>();
     this.OutputDefinitions = new HashSet<SymbolDefinition>();
     this.TaintedDefinitions = new Dictionary<SymbolDefinition, ISet<SymbolDefinition>>();
 }
Beispiel #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context">AnalysisContext</param>
 /// <param name="method">BaseMethodDeclarationSyntax</param>
 /// <param name="parameterTypes">ITypeSymbols</param>
 private MethodSummary(AnalysisContext context, BaseMethodDeclarationSyntax method,
     IDictionary<int, ISet<ITypeSymbol>> parameterTypes)
 {
     this.Id = MethodSummary.IdCounter++;
     this.AnalysisContext = context;
     this.SemanticModel = context.Compilation.GetSemanticModel(method.SyntaxTree);
     this.Method = method;
     this.SideEffectsInfo = new MethodSideEffectsInfo(this);
     this.ResolveMethodParameterTypes(parameterTypes);
 }
Beispiel #4
0
        /// <summary>
        /// Creates the summary of the specified method, using the
        /// specified parameter types.
        /// </summary>
        /// <param name="context">AnalysisContext</param>
        /// <param name="method">BaseMethodDeclarationSyntax</param>
        /// <param name="parameterTypes">ITypeSymbols</param>
        /// <returns>MethodSummary</returns>
        public static MethodSummary Create(AnalysisContext context, BaseMethodDeclarationSyntax method,
            IDictionary<int, ISet<ITypeSymbol>> parameterTypes)
        {
            if (method.Body == null)
            {
                return null;
            }

            var summary = new MethodSummary(context, method, parameterTypes);
            summary.BuildSummary();
            summary.AnalyzeSummary();

            return summary;
        }
Beispiel #5
0
 /// <summary>
 /// Creates the summary of the specified method.
 /// </summary>
 /// <param name="context">AnalysisContext</param>
 /// <param name="method">BaseMethodDeclarationSyntax</param>
 /// <returns>MethodSummary</returns>
 public static MethodSummary Create(AnalysisContext context, BaseMethodDeclarationSyntax method)
 {
     return MethodSummary.Create(context, method, new Dictionary<int, ISet<ITypeSymbol>>());
 }