Skip to content

Commit 1480ac7

Browse files
committed
C++: Potentially improve performance by restricting the size of the call-context relation.
1 parent f6f7020 commit 1480ac7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,11 @@ predicate mayBenefitFromCallContext(CallInstruction call, Function f) {
238238
/**
239239
* Holds if `call` is a call through a function pointer, and the pointer
240240
* value is given as the `arg`'th argument to `f`.
241-
*
242-
* Note that `f` may be several layers up through the call chain.
243241
*/
244242
private predicate mayBenefitFromCallContext(
245243
VirtualDispatch::DataSensitiveCall call, Function f, int arg
246244
) {
245+
f = pragma[only_bind_out](call).getEnclosingCallable() and
247246
exists(InitializeParameterInstruction init |
248247
not exists(call.getStaticCallTarget()) and
249248
init.getEnclosingFunction() = f and

0 commit comments

Comments
 (0)