Skip to content

Commit 9672af3

Browse files
committed
C++: Cache 'interpretElement'. This reduces DIL size of 'cpp/unbounded-write' by about 8%.
1 parent 682dd42 commit 9672af3

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -974,18 +974,19 @@ private Element interpretElement0(
974974
)
975975
}
976976

977-
/** Gets the source/sink/summary element corresponding to the supplied parameters. */
978-
Element interpretElement(
979-
string namespace, string type, boolean subtypes, string name, string signature, string ext
980-
) {
981-
elementSpec(namespace, type, subtypes, name, signature, ext) and
982-
exists(Element e | e = interpretElement0(namespace, type, subtypes, name, signature) |
983-
ext = "" and result = e
984-
)
985-
}
986-
987977
cached
988978
private module Cached {
979+
/** Gets the source/sink/summary element corresponding to the supplied parameters. */
980+
cached
981+
Element interpretElement(
982+
string namespace, string type, boolean subtypes, string name, string signature, string ext
983+
) {
984+
elementSpec(namespace, type, subtypes, name, signature, ext) and
985+
exists(Element e | e = interpretElement0(namespace, type, subtypes, name, signature) |
986+
ext = "" and result = e
987+
)
988+
}
989+
989990
/**
990991
* Holds if `node` is specified as a source with the given kind in a CSV flow
991992
* model.

0 commit comments

Comments
 (0)