Skip to content

Commit ecc9593

Browse files
committed
C#: Remove the unused predicate callable flow.
1 parent c52787c commit ecc9593

File tree

1 file changed

+4
-81
lines changed

1 file changed

+4
-81
lines changed

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

Lines changed: 4 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -262,36 +262,6 @@ class CallableFlowSinkDelegateArg extends CallableFlowSink, TCallableFlowSinkDel
262262
abstract class LibraryTypeDataFlow extends Type {
263263
LibraryTypeDataFlow() { this = this.getUnboundDeclaration() }
264264

265-
/**
266-
* Holds if data may flow from `source` to `sink` when calling callable `c`.
267-
*
268-
* `preservesValue` indicates whether the value from `source` is preserved
269-
* (possibly copied) to `sink`. For example, the value is preserved from `x`
270-
* to `x.ToString()` when `x` is a `string`, but not from `x` to `x.ToLower()`.
271-
*/
272-
pragma[nomagic]
273-
predicate callableFlow(
274-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
275-
boolean preservesValue
276-
) {
277-
none()
278-
}
279-
280-
/**
281-
* Holds if data may flow from `source` to `sink` when calling callable `c`.
282-
*
283-
* `sourceAp` describes the contents of `source` that flows to `sink`
284-
* (if any), and `sinkAp` describes the contents of `sink` that it
285-
* flows to (if any).
286-
*/
287-
pragma[nomagic]
288-
predicate callableFlow(
289-
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
290-
SourceDeclarationCallable c, boolean preservesValue
291-
) {
292-
none()
293-
}
294-
295265
/**
296266
* Holds if values stored inside `content` are cleared on objects passed as
297267
* arguments of type `source` to calls that target `callable`.
@@ -346,73 +316,26 @@ private module FrameworkDataFlowAdaptor {
346316
private class FrameworkDataFlowAdaptor extends SummarizedCallable {
347317
private LibraryTypeDataFlow ltdf;
348318

349-
FrameworkDataFlowAdaptor() {
350-
ltdf.callableFlow(_, _, this, _) or
351-
ltdf.callableFlow(_, _, _, _, this, _) or
352-
ltdf.clearsContent(_, _, this)
353-
}
319+
FrameworkDataFlowAdaptor() { ltdf.clearsContent(_, _, this) }
354320

355321
predicate input(
356322
CallableFlowSource source, AccessPath sourceAp, SummaryComponent head,
357323
SummaryComponentStack tail, int i
358324
) {
359-
ltdf.callableFlow(source, sourceAp, _, _, this, _) and
360-
source = toCallableFlowSource(tail) and
361-
head = SummaryComponent::content(sourceAp.getHead()) and
362-
i = 0
363-
or
364-
exists(SummaryComponent tailHead, SummaryComponentStack tailTail |
365-
this.input(source, sourceAp, tailHead, tailTail, i - 1) and
366-
head = SummaryComponent::content(sourceAp.drop(i).getHead()) and
367-
tail = SummaryComponentStack::push(tailHead, tailTail)
368-
)
325+
none()
369326
}
370327

371328
predicate output(
372329
CallableFlowSink sink, AccessPath sinkAp, SummaryComponent head, SummaryComponentStack tail,
373330
int i
374331
) {
375-
ltdf.callableFlow(_, _, sink, sinkAp, this, _) and
376-
sink = toCallableFlowSink(tail) and
377-
head = SummaryComponent::content(sinkAp.getHead()) and
378-
i = 0
379-
or
380-
exists(SummaryComponent tailHead, SummaryComponentStack tailTail |
381-
this.output(sink, sinkAp, tailHead, tailTail, i - 1) and
382-
head = SummaryComponent::content(sinkAp.drop(i).getHead()) and
383-
tail = SummaryComponentStack::push(tailHead, tailTail)
384-
)
332+
none()
385333
}
386334

387335
override predicate propagatesFlow(
388336
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
389337
) {
390-
ltdf.callableFlow(toCallableFlowSource(input), toCallableFlowSink(output), this,
391-
preservesValue)
392-
or
393-
exists(
394-
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp
395-
|
396-
ltdf.callableFlow(source, sourceAp, sink, sinkAp, this, preservesValue) and
397-
(
398-
exists(SummaryComponent head, SummaryComponentStack tail |
399-
this.input(source, sourceAp, head, tail, sourceAp.length() - 1) and
400-
input = SummaryComponentStack::push(head, tail)
401-
)
402-
or
403-
sourceAp.length() = 0 and
404-
source = toCallableFlowSource(input)
405-
) and
406-
(
407-
exists(SummaryComponent head, SummaryComponentStack tail |
408-
this.output(sink, sinkAp, head, tail, sinkAp.length() - 1) and
409-
output = SummaryComponentStack::push(head, tail)
410-
)
411-
or
412-
sinkAp.length() = 0 and
413-
sink = toCallableFlowSink(output)
414-
)
415-
)
338+
none()
416339
}
417340

418341
override predicate clearsContent(ParameterPosition pos, Content content) {

0 commit comments

Comments
 (0)