Skip to content

Commit 86dd868

Browse files
committed
C#: Update call-sensitivity data-flow tests
1 parent 9c50acc commit 86dd868

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

csharp/ql/test/library-tests/dataflow/call-sensitivity/CallSensitivityFlow.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ public static void Sink(object o)
161161
{
162162
}
163163

164-
public void M()
164+
public virtual void M(object o)
165165
{
166-
166+
Sink(o); // no flow here [FALSE POSITIVE]
167167
}
168168

169169
public void Callsite(InterfaceB intF)
@@ -175,25 +175,25 @@ public void Callsite(InterfaceB intF)
175175
intF.Foo(b, new object(), false);
176176
}
177177

178-
private class B : A2
178+
public class B : A2
179179
{
180-
public void M()
180+
public override void M(object o)
181181
{
182182

183183
}
184184
}
185185

186-
private class IntA : InterfaceB
186+
public class IntA : InterfaceB
187187
{
188188

189189
public void Foo(A2 obj, object o, bool cond)
190190
{
191-
obj.M();
191+
obj.M(o);
192192
Sink(o);
193193
}
194194
}
195195

196-
private class IntB : InterfaceB
196+
public class IntB : InterfaceB
197197
{
198198

199199
public void Foo(A2 obj, object o, bool cond)

csharp/ql/test/library-tests/dataflow/call-sensitivity/CallSensitivityFlow.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ edges
2626
| CallSensitivityFlow.cs:124:43:124:43 | o : Object | CallSensitivityFlow.cs:128:22:128:22 | access to parameter o |
2727
| CallSensitivityFlow.cs:133:44:133:44 | o : Object | CallSensitivityFlow.cs:137:22:137:22 | access to parameter o |
2828
| CallSensitivityFlow.cs:142:49:142:49 | o : Object | CallSensitivityFlow.cs:152:18:152:19 | access to local variable o3 |
29+
| CallSensitivityFlow.cs:164:34:164:34 | o : Object | CallSensitivityFlow.cs:166:14:166:14 | access to parameter o |
2930
| CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | CallSensitivityFlow.cs:189:40:189:40 | o : Object |
31+
| CallSensitivityFlow.cs:189:40:189:40 | o : Object | CallSensitivityFlow.cs:191:19:191:19 | access to parameter o : Object |
3032
| CallSensitivityFlow.cs:189:40:189:40 | o : Object | CallSensitivityFlow.cs:192:18:192:18 | access to parameter o |
33+
| CallSensitivityFlow.cs:191:19:191:19 | access to parameter o : Object | CallSensitivityFlow.cs:164:34:164:34 | o : Object |
3134
nodes
3235
| CallSensitivityFlow.cs:19:39:19:39 | o : Object | semmle.label | o : Object |
3336
| CallSensitivityFlow.cs:23:18:23:18 | access to parameter o | semmle.label | access to parameter o |
@@ -66,8 +69,11 @@ nodes
6669
| CallSensitivityFlow.cs:137:22:137:22 | access to parameter o | semmle.label | access to parameter o |
6770
| CallSensitivityFlow.cs:142:49:142:49 | o : Object | semmle.label | o : Object |
6871
| CallSensitivityFlow.cs:152:18:152:19 | access to local variable o3 | semmle.label | access to local variable o3 |
72+
| CallSensitivityFlow.cs:164:34:164:34 | o : Object | semmle.label | o : Object |
73+
| CallSensitivityFlow.cs:166:14:166:14 | access to parameter o | semmle.label | access to parameter o |
6974
| CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
7075
| CallSensitivityFlow.cs:189:40:189:40 | o : Object | semmle.label | o : Object |
76+
| CallSensitivityFlow.cs:191:19:191:19 | access to parameter o : Object | semmle.label | access to parameter o : Object |
7177
| CallSensitivityFlow.cs:192:18:192:18 | access to parameter o | semmle.label | access to parameter o |
7278
#select
7379
| CallSensitivityFlow.cs:78:24:78:35 | object creation of type Object : Object | CallSensitivityFlow.cs:78:24:78:35 | object creation of type Object : Object | CallSensitivityFlow.cs:23:18:23:18 | access to parameter o | $@ | CallSensitivityFlow.cs:23:18:23:18 | access to parameter o | access to parameter o |
@@ -87,4 +93,5 @@ nodes
8793
| CallSensitivityFlow.cs:117:26:117:37 | object creation of type Object : Object | CallSensitivityFlow.cs:117:26:117:37 | object creation of type Object : Object | CallSensitivityFlow.cs:128:22:128:22 | access to parameter o | $@ | CallSensitivityFlow.cs:128:22:128:22 | access to parameter o | access to parameter o |
8894
| CallSensitivityFlow.cs:118:27:118:38 | object creation of type Object : Object | CallSensitivityFlow.cs:118:27:118:38 | object creation of type Object : Object | CallSensitivityFlow.cs:137:22:137:22 | access to parameter o | $@ | CallSensitivityFlow.cs:137:22:137:22 | access to parameter o | access to parameter o |
8995
| CallSensitivityFlow.cs:119:32:119:43 | object creation of type Object : Object | CallSensitivityFlow.cs:119:32:119:43 | object creation of type Object : Object | CallSensitivityFlow.cs:152:18:152:19 | access to local variable o3 | $@ | CallSensitivityFlow.cs:152:18:152:19 | access to local variable o3 | access to local variable o3 |
96+
| CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | CallSensitivityFlow.cs:166:14:166:14 | access to parameter o | $@ | CallSensitivityFlow.cs:166:14:166:14 | access to parameter o | access to parameter o |
9097
| CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | CallSensitivityFlow.cs:175:21:175:32 | object creation of type Object : Object | CallSensitivityFlow.cs:192:18:192:18 | access to parameter o | $@ | CallSensitivityFlow.cs:192:18:192:18 | access to parameter o | access to parameter o |

0 commit comments

Comments
 (0)