Skip to content

Commit 679aad1

Browse files
committed
C#: Convert System.Collections.Generic.KeyValuePair flow to CSV format.
1 parent 42bf866 commit 679aad1

2 files changed

Lines changed: 12 additions & 21 deletions

File tree

csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,27 +1330,6 @@ class IDictionaryFlow extends LibraryTypeDataFlow, RefType {
13301330
}
13311331
}
13321332

1333-
/** Data flow for `System.Collections.Generic.KeyValuePair`. */
1334-
class SystemCollectionsGenericKeyValuePairStructFlow extends LibraryTypeDataFlow,
1335-
SystemCollectionsGenericKeyValuePairStruct {
1336-
override predicate callableFlow(
1337-
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
1338-
SourceDeclarationCallable c, boolean preservesValue
1339-
) {
1340-
preservesValue = true and
1341-
exists(int i |
1342-
c.(Constructor).getDeclaringType() = this and
1343-
source = TCallableFlowSourceArg(i) and
1344-
sourceAp = AccessPath::empty() and
1345-
sink = TCallableFlowSinkReturn()
1346-
|
1347-
i = 0 and sinkAp = AccessPath::property(this.getKeyProperty())
1348-
or
1349-
i = 1 and sinkAp = AccessPath::property(this.getValueProperty())
1350-
)
1351-
}
1352-
}
1353-
13541333
/** Data flow for `System.[Value]Tuple<,...,>`. */
13551334
class SystemTupleFlow extends LibraryTypeDataFlow, ValueOrRefType {
13561335
SystemTupleFlow() {

csharp/ql/lib/semmle/code/csharp/frameworks/system/collections/Generic.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import csharp
44
private import semmle.code.csharp.frameworks.system.Collections
5+
private import semmle.code.csharp.dataflow.ExternalFlow
56

67
/** The `System.Collections.Generic` namespace. */
78
class SystemCollectionsGenericNamespace extends Namespace {
@@ -123,6 +124,17 @@ class SystemCollectionsGenericKeyValuePairStruct extends SystemCollectionsGeneri
123124
}
124125
}
125126

127+
/** Data flow for `System.Collections.Generic.KeyValuePair`. */
128+
private class SystemCollectionsGenericKeyValuePairStructFlowModelCsv extends SummaryModelCsv {
129+
override predicate row(string row) {
130+
row =
131+
[
132+
"System.Collections.Generic;KeyValuePair<,>;false;KeyValuePair;(TKey,TValue);;Argument[0];Property[System.Collections.Generic.KeyValuePair<,>.Key] of ReturnValue;value",
133+
"System.Collections.Generic;KeyValuePair<,>;false;KeyValuePair;(TKey,TValue);;Argument[1];Property[System.Collections.Generic.KeyValuePair<,>.Value] of ReturnValue;value"
134+
]
135+
}
136+
}
137+
126138
/** The `System.Collections.Generic.ICollection<>` interface. */
127139
class SystemCollectionsGenericICollectionInterface extends SystemCollectionsGenericUnboundGenericInterface {
128140
SystemCollectionsGenericICollectionInterface() { this.hasName("ICollection<>") }

0 commit comments

Comments
 (0)