Skip to content

Commit

Permalink
C++: Cache 'interpretElement'. This reduces DIL size of 'cpp/unbounde…
Browse files Browse the repository at this point in the history
…d-write' by about 8%.
  • Loading branch information
MathiasVP committed Jan 3, 2025
1 parent 682dd42 commit 9672af3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -974,18 +974,19 @@ private Element interpretElement0(
)
}

/** Gets the source/sink/summary element corresponding to the supplied parameters. */
Element interpretElement(
string namespace, string type, boolean subtypes, string name, string signature, string ext
) {
elementSpec(namespace, type, subtypes, name, signature, ext) and
exists(Element e | e = interpretElement0(namespace, type, subtypes, name, signature) |
ext = "" and result = e
)
}

cached
private module Cached {
/** Gets the source/sink/summary element corresponding to the supplied parameters. */
cached
Element interpretElement(
string namespace, string type, boolean subtypes, string name, string signature, string ext
) {
elementSpec(namespace, type, subtypes, name, signature, ext) and
exists(Element e | e = interpretElement0(namespace, type, subtypes, name, signature) |
ext = "" and result = e
)
}

/**
* Holds if `node` is specified as a source with the given kind in a CSV flow
* model.
Expand Down

0 comments on commit 9672af3

Please sign in to comment.