From 2b4da8d6a723d0b3a2515b9368e1aba61945c5ce Mon Sep 17 00:00:00 2001 From: Pavel Avgustinov Date: Fri, 14 Sep 2018 12:22:01 +0100 Subject: [PATCH] Parameter.qll: Tweak how effective declaration entries are computed With the new formulation, we can join on function and index at the same time, leading to significant performance gains on large code bases that use templates extensively. --- cpp/ql/src/semmle/code/cpp/Parameter.qll | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/Parameter.qll b/cpp/ql/src/semmle/code/cpp/Parameter.qll index 971a2f33f610..c6fc33b9355a 100644 --- a/cpp/ql/src/semmle/code/cpp/Parameter.qll +++ b/cpp/ql/src/semmle/code/cpp/Parameter.qll @@ -68,10 +68,9 @@ class Parameter extends LocalScopeVariable, @parameter { */ private VariableDeclarationEntry getAnEffectiveDeclarationEntry() { if getFunction().isConstructedFrom(_) - then exists (Parameter prototype - | prototype = result.getVariable() and - prototype.getIndex() = getIndex() and - getFunction().isConstructedFrom(prototype.getFunction())) + then exists (Function prototypeInstantiation + | prototypeInstantiation.getParameter(getIndex()) = result.getVariable() and + getFunction().isConstructedFrom(prototypeInstantiation)) else result = getADeclarationEntry() }