C++: Cache 'toString' and 'getLocation'.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-02-27 12:02:24 +00:00
parent 86bd0c0dc3
commit f223c957ba

View File

@@ -35,6 +35,17 @@ private module Cached {
not Ssa::ignoreOperand(op) and exists(Ssa::getIRRepresentationOfOperand(op))
}
cached
string toStringCached(Node n) {
result = toExprString(n)
or
not exists(toExprString(n)) and
result = n.toStringImpl()
}
cached
Location getLocationCached(Node n) { result = n.getLocationImpl() }
cached
newtype TContentApprox =
TFieldApproxContent(string s) { fieldHasApproxName(_, s) } or