Java: Replace remaining SsaImplicitInit.

This commit is contained in:
Anders Schack-Mulligen
2025-11-07 10:58:46 +01:00
parent f4b9efcdce
commit 8594ae03df
3 changed files with 7 additions and 9 deletions

View File

@@ -102,10 +102,9 @@ predicate hasNonlocalValue(FieldRead fr) {
not exists(SsaDefinition v | v.getARead() = fr)
or
exists(SsaDefinition v, SsaDefinition def |
v.getARead() = fr and def = v.getAnUltimateDefinition()
|
def instanceof SsaImplicitInit or
def instanceof SsaImplicitUpdate
v.getARead() = fr and
def = v.getAnUltimateDefinition() and
def instanceof SsaImplicitWrite
)
}

View File

@@ -510,9 +510,9 @@ private module Cached {
/** Holds if `init` is a closure variable that captures the value of `capturedvar`. */
cached
predicate captures(SsaImplicitInit init, SsaVariable capturedvar) {
predicate captures(SsaImplicitEntryDefinition init, SsaVariable capturedvar) {
exists(BasicBlock bb, int i |
Impl::ssaDefReachesRead(_, capturedvar, bb, i) and
Ssa::ssaDefReachesUncertainRead(_, capturedvar, bb, i) and
variableCapture(capturedvar.getSourceVariable(), init.getSourceVariable(), bb, i)
)
}

View File

@@ -267,9 +267,8 @@ private module Impl {
}
/** Gets the variable underlying the implicit SSA variable `v`. */
Variable getImplicitSsaDeclaration(SsaVariable v) {
result = v.(SsaImplicitUpdate).getSourceVariable().getVariable() or
result = v.(SsaImplicitInit).getSourceVariable().getVariable()
Variable getImplicitSsaDeclaration(SsaDefinition v) {
result = v.(SsaImplicitWrite).getSourceVariable().getVariable()
}
/** Holds if the variable underlying the implicit SSA variable `v` is not a field. */