Skip to content

Commit 15fa4f8

Browse files
authored
Merge pull request #1007 from jbj/dataflow-dispatch-no-ctx
C++: Simplify stubs in DataFlowDispatch.qll
2 parents b226cb6 + 40f3fec commit 15fa4f8

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,20 @@ predicate reducedViableImplInCallContext(MethodAccess ma, Callable c, Call ctx)
6565
none()
6666
}
6767

68-
/**
69-
* Gets a viable dispatch target of `ma` in the context `ctx`. This is
70-
* restricted to those `ma`s for which a context might make a difference.
71-
*/
72-
private Method viableImplInCallContext(MethodAccess ma, Call ctx) {
73-
// stub implementation
74-
result = viableImpl(ma) and
75-
viableCallable(ctx) = ma.getEnclosingFunction()
76-
}
77-
7868
/**
7969
* Gets a viable dispatch target of `ma` in the context `ctx`. This is
8070
* restricted to those `ma`s for which the context makes a difference.
8171
*/
8272
Method prunedViableImplInCallContext(MethodAccess ma, Call ctx) {
83-
result = viableImplInCallContext(ma, ctx) and
84-
reducedViableImplInCallContext(ma, _, ctx)
73+
none()
8574
}
8675

8776
/**
8877
* Holds if flow returning from `m` to `ma` might return further and if
8978
* this path restricts the set of call sites that can be returned to.
9079
*/
9180
predicate reducedViableImplInReturn(Method m, MethodAccess ma) {
92-
exists(int tgts, int ctxtgts |
93-
m = viableImpl(ma) and
94-
ctxtgts = count(Call ctx | m = viableImplInCallContext(ma, ctx)) and
95-
tgts = strictcount(Call ctx | viableCallable(ctx) = ma.getEnclosingFunction()) and
96-
ctxtgts < tgts
97-
)
81+
none()
9882
}
9983

10084
/**
@@ -103,6 +87,5 @@ predicate reducedViableImplInReturn(Method m, MethodAccess ma) {
10387
* result to `ma` restricts the possible context `ctx`.
10488
*/
10589
Method prunedViableImplInCallContextReverse(MethodAccess ma, Call ctx) {
106-
result = viableImplInCallContext(ma, ctx) and
107-
reducedViableImplInReturn(result, ma)
90+
none()
10891
}

0 commit comments

Comments
 (0)