Skip to content

Commit 2b4da8d

Browse files
committed
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.
1 parent c9cb2a0 commit 2b4da8d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cpp/ql/src/semmle/code/cpp/Parameter.qll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ class Parameter extends LocalScopeVariable, @parameter {
6868
*/
6969
private VariableDeclarationEntry getAnEffectiveDeclarationEntry() {
7070
if getFunction().isConstructedFrom(_)
71-
then exists (Parameter prototype
72-
| prototype = result.getVariable() and
73-
prototype.getIndex() = getIndex() and
74-
getFunction().isConstructedFrom(prototype.getFunction()))
71+
then exists (Function prototypeInstantiation
72+
| prototypeInstantiation.getParameter(getIndex()) = result.getVariable() and
73+
getFunction().isConstructedFrom(prototypeInstantiation))
7574
else result = getADeclarationEntry()
7675
}
7776

0 commit comments

Comments
 (0)