Use shared getScope instead of getRoot

This commit is contained in:
Owen Mansel-Chan
2026-01-28 16:41:37 +00:00
parent b2f878229d
commit 52c510bfea
3 changed files with 4 additions and 7 deletions

View File

@@ -42,10 +42,7 @@ private module Input implements BB::InputSig<Location> {
private module BbImpl = BB::Make<Location, Input>;
class BasicBlock extends BbImpl::BasicBlock {
/** Gets the innermost function or file to which this basic block belongs. */
ControlFlow::Root getRoot() { result = this.getScope() }
}
class BasicBlock = BbImpl::BasicBlock;
class EntryBasicBlock = BbImpl::EntryBasicBlock;

View File

@@ -144,7 +144,7 @@ class SsaDefinition extends TSsaDefinition {
abstract string prettyPrintRef();
/** Gets the innermost function or file to which this SSA definition belongs. */
ControlFlow::Root getRoot() { result = this.getBasicBlock().getRoot() }
ControlFlow::Root getRoot() { result = this.getBasicBlock().getScope() }
/** Gets a textual representation of this element. */
string toString() { result = this.prettyPrintDef() }

View File

@@ -86,7 +86,7 @@ private module Internal {
/** Holds if the `i`th node of `bb` in function `f` is an entry node. */
private predicate entryNode(FuncDef f, ReachableBasicBlock bb, int i) {
f = bb.getRoot() and
f = bb.getScope() and
bb.getNode(i).isEntryNode()
}
@@ -94,7 +94,7 @@ private module Internal {
* Holds if the `i`th node of `bb` in function `f` is a function call.
*/
private predicate callNode(FuncDef f, ReachableBasicBlock bb, int i) {
f = bb.getRoot() and
f = bb.getScope() and
bb.getNode(i).(IR::EvalInstruction).getExpr() instanceof CallExpr
}