Skip to content

Commit f223c95

Browse files
committed
C++: Cache 'toString' and 'getLocation'.
1 parent 86bd0c0 commit f223c95

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ private module Cached {
3535
not Ssa::ignoreOperand(op) and exists(Ssa::getIRRepresentationOfOperand(op))
3636
}
3737

38+
cached
39+
string toStringCached(Node n) {
40+
result = toExprString(n)
41+
or
42+
not exists(toExprString(n)) and
43+
result = n.toStringImpl()
44+
}
45+
46+
cached
47+
Location getLocationCached(Node n) { result = n.getLocationImpl() }
48+
3849
cached
3950
newtype TContentApprox =
4051
TFieldApproxContent(string s) { fieldHasApproxName(_, s) } or

0 commit comments

Comments
 (0)