Skip to content

Commit 40f3fec

Browse files
committed
C++: Simplify stubs in DataFlowDispatch.qll
Some of these stubs were quite slow to evaluate. It's possible they could be optimised, but it seems pointless as long as we don't have call-context-sensitive virtual dispatch in the C++ library.
1 parent 86e646b commit 40f3fec

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
@@ -17,36 +17,20 @@ predicate reducedViableImplInCallContext(MethodAccess ma, Callable c, Call ctx)
1717
none()
1818
}
1919

20-
/**
21-
* Gets a viable dispatch target of `ma` in the context `ctx`. This is
22-
* restricted to those `ma`s for which a context might make a difference.
23-
*/
24-
private Method viableImplInCallContext(MethodAccess ma, Call ctx) {
25-
// stub implementation
26-
result = viableImpl(ma) and
27-
viableCallable(ctx) = ma.getEnclosingFunction()
28-
}
29-
3020
/**
3121
* Gets a viable dispatch target of `ma` in the context `ctx`. This is
3222
* restricted to those `ma`s for which the context makes a difference.
3323
*/
3424
Method prunedViableImplInCallContext(MethodAccess ma, Call ctx) {
35-
result = viableImplInCallContext(ma, ctx) and
36-
reducedViableImplInCallContext(ma, _, ctx)
25+
none()
3726
}
3827

3928
/**
4029
* Holds if flow returning from `m` to `ma` might return further and if
4130
* this path restricts the set of call sites that can be returned to.
4231
*/
4332
predicate reducedViableImplInReturn(Method m, MethodAccess ma) {
44-
exists(int tgts, int ctxtgts |
45-
m = viableImpl(ma) and
46-
ctxtgts = count(Call ctx | m = viableImplInCallContext(ma, ctx)) and
47-
tgts = strictcount(Call ctx | viableCallable(ctx) = ma.getEnclosingFunction()) and
48-
ctxtgts < tgts
49-
)
33+
none()
5034
}
5135

5236
/**
@@ -55,6 +39,5 @@ predicate reducedViableImplInReturn(Method m, MethodAccess ma) {
5539
* result to `ma` restricts the possible context `ctx`.
5640
*/
5741
Method prunedViableImplInCallContextReverse(MethodAccess ma, Call ctx) {
58-
result = viableImplInCallContext(ma, ctx) and
59-
reducedViableImplInReturn(result, ma)
42+
none()
6043
}

0 commit comments

Comments
 (0)