diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll index 7d393ff9538..ff048561677 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll @@ -1330,27 +1330,6 @@ class IDictionaryFlow extends LibraryTypeDataFlow, RefType { } } -/** Data flow for `System.Collections.Generic.KeyValuePair`. */ -class SystemCollectionsGenericKeyValuePairStructFlow extends LibraryTypeDataFlow, - SystemCollectionsGenericKeyValuePairStruct { - override predicate callableFlow( - CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp, - SourceDeclarationCallable c, boolean preservesValue - ) { - preservesValue = true and - exists(int i | - c.(Constructor).getDeclaringType() = this and - source = TCallableFlowSourceArg(i) and - sourceAp = AccessPath::empty() and - sink = TCallableFlowSinkReturn() - | - i = 0 and sinkAp = AccessPath::property(this.getKeyProperty()) - or - i = 1 and sinkAp = AccessPath::property(this.getValueProperty()) - ) - } -} - /** Data flow for `System.[Value]Tuple<,...,>`. */ class SystemTupleFlow extends LibraryTypeDataFlow, ValueOrRefType { SystemTupleFlow() { diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/system/collections/Generic.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/system/collections/Generic.qll index 2b632d2b07c..210fcc45ea9 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/system/collections/Generic.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/system/collections/Generic.qll @@ -2,6 +2,7 @@ import csharp private import semmle.code.csharp.frameworks.system.Collections +private import semmle.code.csharp.dataflow.ExternalFlow /** The `System.Collections.Generic` namespace. */ class SystemCollectionsGenericNamespace extends Namespace { @@ -123,6 +124,17 @@ class SystemCollectionsGenericKeyValuePairStruct extends SystemCollectionsGeneri } } +/** Data flow for `System.Collections.Generic.KeyValuePair`. */ +private class SystemCollectionsGenericKeyValuePairStructFlowModelCsv extends SummaryModelCsv { + override predicate row(string row) { + row = + [ + "System.Collections.Generic;KeyValuePair<,>;false;KeyValuePair;(TKey,TValue);;Argument[0];Property[System.Collections.Generic.KeyValuePair<,>.Key] of ReturnValue;value", + "System.Collections.Generic;KeyValuePair<,>;false;KeyValuePair;(TKey,TValue);;Argument[1];Property[System.Collections.Generic.KeyValuePair<,>.Value] of ReturnValue;value" + ] + } +} + /** The `System.Collections.Generic.ICollection<>` interface. */ class SystemCollectionsGenericICollectionInterface extends SystemCollectionsGenericUnboundGenericInterface { SystemCollectionsGenericICollectionInterface() { this.hasName("ICollection<>") }