FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update some uses of ExprNode to bind the variable · github/codeql@fab449a · GitHub

Repository navigation

Commit fab449a

Browse files
committed
Update some uses of ExprNode to bind the variable
1 parent cbd6d35 commit fab449a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎shared/ssa/codeql/ssa/Ssa.qll‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,8 @@ module Make<
17421742
/** Gets the underlying expression. */
17431743
DfInput::Expr getExpr() { result = e }
17441744

1745+
predicate isExprAndVariable(DfInput::Expr expr, SourceVariable var) { expr = e and var = v_ }
1746+
17451747
override Location getLocation() {
17461748
exists(BasicBlock bb, int i |
17471749
e.hasCfgNode(bb, i) and
@@ -1769,7 +1771,7 @@ module Make<
17691771
ExprPostUpdateNodeImpl() { isPost = true }
17701772

17711773
/** Gets the pre-update expression node. */
1772-
ExprNode getPreUpdateNode() { result = TExprNode(e, _, false) }
1774+
ExprNode getPreUpdateNode() { result = TExprNode(e, v_, false) }
17731775

17741776
override string toString() { result = e.toString() + " [postupdate]" }
17751777
}
@@ -2026,13 +2028,13 @@ module Make<
20262028
v = def.getSourceVariable() and
20272029
if DfInput::includeWriteDefsInFlowStep()
20282030
then nodeTo.(SsaDefinitionNode).getDefinition() = def
2029-
else nodeTo.(ExprNode).getExpr() = DfInput::getARead(def)
2031+
else nodeTo.(ExprNode).isExprAndVariable(DfInput::getARead(def), v)
20302032
)
20312033
or
20322034
// Flow from SSA definition to read
20332035
exists(DefinitionExt def |
20342036
nodeFrom.(SsaDefinitionExtNodeImpl).getDefExt() = def and
2035-
nodeTo.(ExprNode).getExpr() = DfInput::getARead(def) and
2037+
nodeTo.(ExprNode).isExprAndVariable(DfInput::getARead(def), v) and
20362038
v = def.getSourceVariable()
20372039
)
20382040
}
@@ -2138,7 +2140,7 @@ module Make<
21382140
e = DfInput::getARead(def) and
21392141
e.hasCfgNode(bb, _) and
21402142
DfInput::guardControlsBlock(g, bb, val) and
2141-
result.(ExprNode).getExpr() = e
2143+
result.(ExprNode).isExprAndVariable(e, def.getSourceVariable())
21422144
)
21432145
or
21442146
// guard controls input block to a phi node

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL