DataFlow: Cached second level scope.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-04-26 13:09:59 +01:00
parent 8d962a5c28
commit 2482519cd3
2 changed files with 6 additions and 2 deletions

View File

@@ -1119,9 +1119,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
pragma[nomagic]
private SndLevelScopeOption getScope(RetNodeEx ret) {
result = SndLevelScopeOption::some(getSecondLevelScope(ret.asNode()))
result = SndLevelScopeOption::some(getSecondLevelScopeCached(ret.asNode()))
or
result instanceof SndLevelScopeOption::None and not exists(getSecondLevelScope(ret.asNode()))
result instanceof SndLevelScopeOption::None and
not exists(getSecondLevelScopeCached(ret.asNode()))
}
pragma[nomagic]

View File

@@ -616,6 +616,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
cached
predicate forceCachingInSameStage() { any() }
cached
DataFlowSecondLevelScope getSecondLevelScopeCached(Node n) { result = getSecondLevelScope(n) }
cached
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }