Go: deprecate ConditionGuardNode · github/codeql@d5a6f9e · GitHub
Skip to content

Commit d5a6f9e

Browse files
owen-mcCopilot
andcommitted
Go: deprecate ConditionGuardNode
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 41c9afd commit d5a6f9e

4 files changed

Lines changed: 53 additions & 17 deletions

File tree

‎go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll‎

Lines changed: 42 additions & 14 deletions

‎go/ql/lib/semmle/go/controlflow/IR.qll‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ module IR {
8080
typeSwitchCaseMatch(this, _)
8181
or
8282
// `NotExpr` and `LogicalBinaryExpr` are not in `postOrInOrder`, so they
83-
// have no `isIn` node. Use their combined after-node as the value-producing
84-
// instruction, but not a value-specific after-node, which is already a
85-
// `ConditionGuardInstruction`.
83+
// have no `isIn` node. When such an expression is not in a conditional
84+
// context (so it has a single combined after-node rather than per-branch
85+
// value-after-nodes), use that after-node as the value-producing
86+
// instruction. In conditional contexts the value is already split
87+
// across branches, so no separate value instruction is needed.
8688
exists(Expr e |
8789
(e instanceof NotExpr or e instanceof LogicalBinaryExpr) and
8890
this.isAfter(e) and

‎go/ql/test/library-tests/semmle/go/controlflow/Guards/Guards.expected‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,5 @@ modelBarrierResult
271271
| guards.go:360:27:360:33 | pointer | model null | model-null |
272272
| guards.go:363:31:363:37 | pointer | model not null | model-not-null |
273273
| guards.go:366:34:366:40 | pointer | model no exception | model-no-exception |
274+
legacyConditionGuardCount
275+
| 88 |

‎go/ql/test/library-tests/semmle/go/controlflow/Guards/Guards.ql‎

Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)