Skip to content

Commit 0b21caa

Browse files
authored
Merge pull request github#6280 from MathiasVP/restrict-call-context-relation
C++: Potentially improve performance of call-context calculation
2 parents 3ae99b9 + 1480ac7 commit 0b21caa

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)