Merge pull request #242 from microsoft/powershell-guardpredicate-fix

added hasbranchedge
This commit is contained in:
dilanbhalla
2025-06-03 12:31:26 -07:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -88,3 +88,4 @@ jobs:
fi
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}

View File

@@ -278,12 +278,21 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
* guard to `branch`.
*/
predicate controlsBranchEdge(SsaInput::BasicBlock bb1, SsaInput::BasicBlock bb2, boolean branch) {
hasBranchEdge(bb1, bb2, branch)
}
/**
* Holds if the evaluation of this guard to `branch` corresponds to the edge
* from `bb1` to `bb2`.
*/
predicate hasBranchEdge(SsaInput::BasicBlock bb1, SsaInput::BasicBlock bb2, boolean branch) {
exists(Cfg::SuccessorTypes::ConditionalSuccessor s |
this.getBasicBlock() = bb1 and
bb2 = bb1.getASuccessor(s) and
s.getValue() = branch
)
}
}
/** Holds if the guard `guard` controls block `bb` upon evaluating to `branch`. */