From 5fd1c6fedbc2de9aa54a8bee108f1d8ae01d468d Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 23 Jan 2020 13:29:48 +0100 Subject: [PATCH] C++: Remove parameter from predicate for some tiny performance benefits --- .../code/cpp/ir/dataflow/internal/DataFlowDispatch.qll | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll index 0abebd71aa4..277c36e27a9 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll @@ -98,7 +98,7 @@ private module VirtualDispatch { .getObjectAddress() .(VariableAddressInstruction) .getASTVariable() and - this.flowsFromGlobalUnionField(var, _, a) + this.flowsFromGlobalUnionField(var, a) ) ) and allowFromArg = true @@ -112,11 +112,10 @@ private module VirtualDispatch { ) } - private predicate flowsFromGlobalUnionField(Variable var, Field f, FieldAccess a) { - f.getDeclaringType() instanceof Union and + private predicate flowsFromGlobalUnionField(Variable var, FieldAccess a) { + a.getTarget().getDeclaringType() instanceof Union and exists(LoadInstruction load | this.flowsFrom(DataFlow::instructionNode(load), _) and - a.getTarget() = f and load .getSourceAddress() .(FieldAddressInstruction)