/// <summary> /// Creates a new object that is a copy of /// the current instance. /// </summary> /// <returns>DataFlowInfo</returns> internal DataFlowInfo Clone() { var newInfo = new DataFlowInfo(this.DataFlowNode, this.AnalysisContext); newInfo.GeneratedDefinitions.UnionWith(this.GeneratedDefinitions); newInfo.KilledDefinitions.UnionWith(this.KilledDefinitions); newInfo.InputDefinitions.UnionWith(this.InputDefinitions); newInfo.OutputDefinitions.UnionWith(this.OutputDefinitions); foreach (var pair in this.TaintedDefinitions) { newInfo.TaintedDefinitions.Add(pair.Key, new HashSet <SymbolDefinition>(pair.Value)); } return(newInfo); }
/// <summary> /// Compare with the specified data-flow information. /// </summary> /// <param name="oldInfo">DataFlowInfo</param> /// <param name="newInfo">DataFlowInfo</param> /// <returns>Boolean</returns> private bool Compare(DataFlowInfo oldInfo, DataFlowInfo newInfo) { if (!oldInfo.GeneratedDefinitions.SetEquals(newInfo.GeneratedDefinitions) || !oldInfo.KilledDefinitions.SetEquals(newInfo.KilledDefinitions) || !oldInfo.InputDefinitions.SetEquals(newInfo.InputDefinitions) || !oldInfo.OutputDefinitions.SetEquals(newInfo.OutputDefinitions) || !oldInfo.TaintedDefinitions.Keys.SequenceEqual(newInfo.TaintedDefinitions.Keys)) { return(false); } foreach (var symbol in oldInfo.TaintedDefinitions) { if (!symbol.Value.SetEquals(newInfo.TaintedDefinitions[symbol.Key])) { return(false); } } return(true); }
/// <summary> /// Creates a new object that is a copy of /// the current instance. /// </summary> /// <returns>DataFlowInfo</returns> internal DataFlowInfo Clone() { var newInfo = new DataFlowInfo(this.DataFlowNode, this.AnalysisContext); newInfo.GeneratedDefinitions.UnionWith(this.GeneratedDefinitions); newInfo.KilledDefinitions.UnionWith(this.KilledDefinitions); newInfo.InputDefinitions.UnionWith(this.InputDefinitions); newInfo.OutputDefinitions.UnionWith(this.OutputDefinitions); foreach (var pair in this.TaintedDefinitions) { newInfo.TaintedDefinitions.Add(pair.Key, new HashSet<SymbolDefinition>(pair.Value)); } return newInfo; }
/// <summary> /// Compare with the specified data-flow information. /// </summary> /// <param name="oldInfo">DataFlowInfo</param> /// <param name="newInfo">DataFlowInfo</param> /// <returns>Boolean</returns> private bool Compare(DataFlowInfo oldInfo, DataFlowInfo newInfo) { if (!oldInfo.GeneratedDefinitions.SetEquals(newInfo.GeneratedDefinitions) || !oldInfo.KilledDefinitions.SetEquals(newInfo.KilledDefinitions) || !oldInfo.InputDefinitions.SetEquals(newInfo.InputDefinitions) || !oldInfo.OutputDefinitions.SetEquals(newInfo.OutputDefinitions) || !oldInfo.TaintedDefinitions.Keys.SequenceEqual(newInfo.TaintedDefinitions.Keys)) { return false; } foreach (var symbol in oldInfo.TaintedDefinitions) { if (!symbol.Value.SetEquals(newInfo.TaintedDefinitions[symbol.Key])) { return false; } } return true; }