Skip to content

Commit 132b8ba

Browse files
committed
C#: Delete summarized callable implementation for record flow and update expected output.
1 parent 009ea1b commit 132b8ba

File tree

2 files changed

+2
-77
lines changed

2 files changed

+2
-77
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -358,63 +358,6 @@ private module BidirectionalImports {
358358
private import semmle.code.csharp.frameworks.EntityFramework
359359
}
360360

361-
private predicate recordConstructorFlow(Constructor c, int i, Property p) {
362-
c = any(RecordType r).getAMember() and
363-
exists(string name |
364-
c.getParameter(i).getName() = name and
365-
c.getDeclaringType().getAMember(name) = p
366-
)
367-
}
368-
369-
private class RecordConstructorFlow extends Impl::Private::SummarizedCallableImpl {
370-
RecordConstructorFlow() { recordConstructorFlow(this, _, _) }
371-
372-
predicate propagatesFlowImpl(
373-
Impl::Private::SummaryComponentStack input, Impl::Private::SummaryComponentStack output,
374-
boolean preservesValue
375-
) {
376-
exists(int i, Property p |
377-
recordConstructorFlow(this, i, p) and
378-
input = Private::SummaryComponentStack::argument(i) and
379-
output =
380-
Private::SummaryComponentStack::propertyOf(p, Private::SummaryComponentStack::return()) and
381-
preservesValue = true
382-
)
383-
}
384-
385-
override predicate propagatesFlow(
386-
Impl::Private::SummaryComponentStack input, Impl::Private::SummaryComponentStack output,
387-
boolean preservesValue
388-
) {
389-
this.propagatesFlowImpl(input, output, preservesValue)
390-
}
391-
392-
override predicate hasProvenance(Public::Provenance provenance) { provenance = "manual" }
393-
}
394-
395-
// see `SummarizedCallableImpl` qldoc
396-
private class RecordConstructorFlowAdapter extends Impl::Public::SummarizedCallable instanceof RecordConstructorFlow
397-
{
398-
override predicate propagatesFlow(string input, string output, boolean preservesValue) { none() }
399-
400-
override predicate hasProvenance(Public::Provenance provenance) {
401-
RecordConstructorFlow.super.hasProvenance(provenance)
402-
}
403-
}
404-
405-
private class RecordConstructorFlowRequiredSummaryComponentStack extends Impl::Private::RequiredSummaryComponentStack
406-
{
407-
override predicate required(
408-
Impl::Private::SummaryComponent head, Impl::Private::SummaryComponentStack tail
409-
) {
410-
exists(Property p |
411-
recordConstructorFlow(_, _, p) and
412-
head = Private::SummaryComponent::property(p) and
413-
tail = Private::SummaryComponentStack::return()
414-
)
415-
}
416-
}
417-
418361
private import semmle.code.csharp.frameworks.system.linq.Expressions
419362

420363
private predicate mayInvokeCallback(Callable c, int n) {

csharp/ql/test/library-tests/dataflow/constructors/ConstructorFlow.expected

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
testFailures
2+
| Constructors.cs:144:24:144:42 | // ... | Missing result:hasValueFlow=9 |
3+
| Constructors.cs:145:24:145:43 | // ... | Missing result:hasValueFlow=10 |
24
edges
35
| Constructors.cs:5:24:5:25 | [post] this access : C_no_ctor [field s1] : Object | Constructors.cs:9:27:9:41 | object creation of type C_no_ctor : C_no_ctor [field s1] : Object | provenance | |
46
| Constructors.cs:5:29:5:45 | call to method Source<Object> : Object | Constructors.cs:5:24:5:25 | [post] this access : C_no_ctor [field s1] : Object | provenance | |
@@ -78,14 +80,6 @@ edges
7880
| Constructors.cs:132:29:132:30 | access to local variable o2 : Object | Constructors.cs:132:18:132:31 | object creation of type C4 : C4 [property Obj2] : Object | provenance | |
7981
| Constructors.cs:133:14:133:15 | access to local variable c4 : C4 [property Obj1] : Object | Constructors.cs:133:14:133:20 | access to property Obj1 | provenance | |
8082
| Constructors.cs:134:14:134:15 | access to local variable c4 : C4 [property Obj2] : Object | Constructors.cs:134:14:134:20 | access to property Obj2 | provenance | |
81-
| Constructors.cs:141:18:141:34 | call to method Source<Object> : Object | Constructors.cs:143:25:143:26 | access to local variable o1 : Object | provenance | |
82-
| Constructors.cs:142:18:142:35 | call to method Source<Object> : Object | Constructors.cs:143:29:143:30 | access to local variable o2 : Object | provenance | |
83-
| Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj1] : Object | Constructors.cs:144:14:144:15 | access to local variable r1 : R1 [property Obj1] : Object | provenance | |
84-
| Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj2] : Object | Constructors.cs:145:14:145:15 | access to local variable r1 : R1 [property Obj2] : Object | provenance | |
85-
| Constructors.cs:143:25:143:26 | access to local variable o1 : Object | Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj1] : Object | provenance | |
86-
| Constructors.cs:143:29:143:30 | access to local variable o2 : Object | Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj2] : Object | provenance | |
87-
| Constructors.cs:144:14:144:15 | access to local variable r1 : R1 [property Obj1] : Object | Constructors.cs:144:14:144:20 | access to property Obj1 | provenance | |
88-
| Constructors.cs:145:14:145:15 | access to local variable r1 : R1 [property Obj2] : Object | Constructors.cs:145:14:145:20 | access to property Obj2 | provenance | |
8983
nodes
9084
| Constructors.cs:5:24:5:25 | [post] this access : C_no_ctor [field s1] : Object | semmle.label | [post] this access : C_no_ctor [field s1] : Object |
9185
| Constructors.cs:5:29:5:45 | call to method Source<Object> : Object | semmle.label | call to method Source<Object> : Object |
@@ -172,16 +166,6 @@ nodes
172166
| Constructors.cs:133:14:133:20 | access to property Obj1 | semmle.label | access to property Obj1 |
173167
| Constructors.cs:134:14:134:15 | access to local variable c4 : C4 [property Obj2] : Object | semmle.label | access to local variable c4 : C4 [property Obj2] : Object |
174168
| Constructors.cs:134:14:134:20 | access to property Obj2 | semmle.label | access to property Obj2 |
175-
| Constructors.cs:141:18:141:34 | call to method Source<Object> : Object | semmle.label | call to method Source<Object> : Object |
176-
| Constructors.cs:142:18:142:35 | call to method Source<Object> : Object | semmle.label | call to method Source<Object> : Object |
177-
| Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj1] : Object | semmle.label | object creation of type R1 : R1 [property Obj1] : Object |
178-
| Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj2] : Object | semmle.label | object creation of type R1 : R1 [property Obj2] : Object |
179-
| Constructors.cs:143:25:143:26 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
180-
| Constructors.cs:143:29:143:30 | access to local variable o2 : Object | semmle.label | access to local variable o2 : Object |
181-
| Constructors.cs:144:14:144:15 | access to local variable r1 : R1 [property Obj1] : Object | semmle.label | access to local variable r1 : R1 [property Obj1] : Object |
182-
| Constructors.cs:144:14:144:20 | access to property Obj1 | semmle.label | access to property Obj1 |
183-
| Constructors.cs:145:14:145:15 | access to local variable r1 : R1 [property Obj2] : Object | semmle.label | access to local variable r1 : R1 [property Obj2] : Object |
184-
| Constructors.cs:145:14:145:20 | access to property Obj2 | semmle.label | access to property Obj2 |
185169
subpaths
186170
| Constructors.cs:64:37:64:37 | access to parameter o : Object | Constructors.cs:57:54:57:55 | o2 : Object | Constructors.cs:59:13:59:19 | SSA def(o1) : Object | Constructors.cs:64:27:64:34 | SSA def(o22param) : Object |
187171
| Constructors.cs:71:25:71:25 | access to local variable o : Object | Constructors.cs:41:26:41:26 | o : Object | Constructors.cs:41:32:41:34 | [post] this access : C1 [field Obj] : Object | Constructors.cs:71:18:71:26 | object creation of type C1 : C1 [field Obj] : Object |
@@ -209,5 +193,3 @@ subpaths
209193
| Constructors.cs:113:14:113:21 | access to property Obj31 | Constructors.cs:111:19:111:35 | call to method Source<Object> : Object | Constructors.cs:113:14:113:21 | access to property Obj31 | $@ | Constructors.cs:111:19:111:35 | call to method Source<Object> : Object | call to method Source<Object> : Object |
210194
| Constructors.cs:133:14:133:20 | access to property Obj1 | Constructors.cs:130:18:130:34 | call to method Source<Object> : Object | Constructors.cs:133:14:133:20 | access to property Obj1 | $@ | Constructors.cs:130:18:130:34 | call to method Source<Object> : Object | call to method Source<Object> : Object |
211195
| Constructors.cs:134:14:134:20 | access to property Obj2 | Constructors.cs:131:18:131:34 | call to method Source<Object> : Object | Constructors.cs:134:14:134:20 | access to property Obj2 | $@ | Constructors.cs:131:18:131:34 | call to method Source<Object> : Object | call to method Source<Object> : Object |
212-
| Constructors.cs:144:14:144:20 | access to property Obj1 | Constructors.cs:141:18:141:34 | call to method Source<Object> : Object | Constructors.cs:144:14:144:20 | access to property Obj1 | $@ | Constructors.cs:141:18:141:34 | call to method Source<Object> : Object | call to method Source<Object> : Object |
213-
| Constructors.cs:145:14:145:20 | access to property Obj2 | Constructors.cs:142:18:142:35 | call to method Source<Object> : Object | Constructors.cs:145:14:145:20 | access to property Obj2 | $@ | Constructors.cs:142:18:142:35 | call to method Source<Object> : Object | call to method Source<Object> : Object |

0 commit comments

Comments
 (0)