Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssa: Update qltests including consistency checks #18869

Merged
merged 12 commits into from
Mar 5, 2025
Merged
Prev Previous commit
Next Next commit
SSA: Use Definition.getLocation in DefinitionExt.
  • Loading branch information
aschackmull committed Mar 4, 2025
commit f5eb2d94bc6485b3aac854c7096557a0d66e1b4b
8 changes: 3 additions & 5 deletions shared/ssa/codeql/ssa/Ssa.qll
Original file line number Diff line number Diff line change
@@ -1256,11 +1256,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
string toString() { result = this.(Definition).toString() }

/** Gets the location of this SSA definition. */
Location getLocation() {
exists(BasicBlock bb, int i | this.definesAt(_, bb, i, _) |
if i = -1 then result = bb.getLocation() else result = bb.getNode(i).getLocation()
)
}
Location getLocation() { result = this.(Definition).getLocation() }
}

/**
@@ -1346,6 +1342,8 @@ module Make<LocationSig Location, InputSig<Location> Input> {
*/
class PhiReadNode extends DefinitionExt, TPhiReadNode {
override string toString() { result = "SSA phi read(" + this.getSourceVariable() + ")" }

override Location getLocation() { result = this.getBasicBlock().getLocation() }
}

/** Provides a set of consistency queries. */