mirror of
https://github.com/github/codeql.git
synced 2026-03-01 05:13:41 +01:00
Java, C#: Refactor implicitSsaDefSign in sign analysis
This commit is contained in:
@@ -245,6 +245,13 @@ private Sign ssaDefSign(SsaVariable v) {
|
||||
)
|
||||
}
|
||||
|
||||
/** Returns the sign of implicit SSA definition `v`. */
|
||||
private Sign implicitSsaDefSign(SsaVariable v) {
|
||||
result = fieldSign(getImplicitSsaDeclaration(v))
|
||||
or
|
||||
anySign(result) and nonFieldImplicitSsaDefinition(v)
|
||||
}
|
||||
|
||||
/** Gets a possible sign for `e`. */
|
||||
cached
|
||||
Sign exprSign(Expr e) {
|
||||
|
||||
@@ -115,13 +115,15 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
/** Returns the sign of implicit SSA definition `v`. */
|
||||
Sign implicitSsaDefSign(SsaVariable v) {
|
||||
result = fieldSign(v.(SsaImplicitUpdate).getSourceVariable().getVariable())
|
||||
or
|
||||
result = fieldSign(v.(SsaImplicitInit).getSourceVariable().getVariable())
|
||||
or
|
||||
anySign(result) and exists(Parameter p | v.(SsaImplicitInit).isParameterDefinition(p))
|
||||
/** Gets the variable underlying the implicit SSA variable `v`. */
|
||||
Variable getImplicitSsaDeclaration(SsaVariable v) {
|
||||
result = v.(SsaImplicitUpdate).getSourceVariable().getVariable() or
|
||||
result = v.(SsaImplicitInit).getSourceVariable().getVariable()
|
||||
}
|
||||
|
||||
/** Holds if the variable underlying the implicit SSA variable `v` is not a field. */
|
||||
predicate nonFieldImplicitSsaDefinition(SsaImplicitInit v) {
|
||||
exists(Parameter p | v.isParameterDefinition(p))
|
||||
}
|
||||
|
||||
/** Gets a possible sign for `f`. */
|
||||
|
||||
Reference in New Issue
Block a user