Skip to content

Commit 9acb58e

Browse files
committed
SSA: Add SsaNode predicates that don't mention DefinitionExt.
1 parent 1c616d1 commit 9acb58e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

shared/ssa/codeql/ssa/Ssa.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,15 @@ module Make<LocationSig Location, InputSig<Location> Input> {
17151715
abstract private class SsaNodeImpl extends NodeImpl {
17161716
/** Gets the underlying SSA definition. */
17171717
abstract DefinitionExt getDefinitionExt();
1718+
1719+
/** Gets the SSA definition this node corresponds to, if any. */
1720+
Definition asDefinition() { this = TSsaDefinitionNode(result) }
1721+
1722+
/** Gets the basic block to which this node belongs. */
1723+
abstract BasicBlock getBasicBlock();
1724+
1725+
/** Gets the underlying source variable that this node tracks flow for. */
1726+
abstract SourceVariable getSourceVariable();
17181727
}
17191728

17201729
final class SsaNode = SsaNodeImpl;
@@ -1727,6 +1736,10 @@ module Make<LocationSig Location, InputSig<Location> Input> {
17271736

17281737
override DefinitionExt getDefinitionExt() { result = def }
17291738

1739+
override BasicBlock getBasicBlock() { result = def.getBasicBlock() }
1740+
1741+
override SourceVariable getSourceVariable() { result = def.getSourceVariable() }
1742+
17301743
override Location getLocation() { result = def.getLocation() }
17311744

17321745
override string toString() { result = def.toString() }
@@ -1783,6 +1796,10 @@ module Make<LocationSig Location, InputSig<Location> Input> {
17831796

17841797
override SsaInputDefinitionExt getDefinitionExt() { result = def_ }
17851798

1799+
override BasicBlock getBasicBlock() { result = input_ }
1800+
1801+
override SourceVariable getSourceVariable() { result = def_.getSourceVariable() }
1802+
17861803
override Location getLocation() { result = input_.getNode(input_.length() - 1).getLocation() }
17871804

17881805
override string toString() { result = "[input] " + def_.toString() }

0 commit comments

Comments
 (0)