Skip to content

Commit 265dd37

Browse files
hvitvedCopilot
andcommitted
Fix shared CFG abrupt completions
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 22bb94e commit 265dd37

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

‎shared/controlflow/codeql/controlflow/ControlFlowGraph.qll‎

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,28 +1254,28 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
12541254
or
12551255
n.isIn(ast) and
12561256
always = true and
1257-
(
1257+
exists(SuccessorType st |
12581258
ast instanceof ReturnStmt and
1259-
c.getSuccessorType() instanceof ReturnSuccessor
1259+
st instanceof ReturnSuccessor
12601260
or
12611261
ast instanceof Throw and
1262-
c.getSuccessorType() instanceof ExceptionSuccessor
1262+
st instanceof ExceptionSuccessor
12631263
or
12641264
ast instanceof BreakStmt and
1265-
c.getSuccessorType() instanceof BreakSuccessor
1265+
st instanceof BreakSuccessor
12661266
or
12671267
ast instanceof ContinueStmt and
1268-
c.getSuccessorType() instanceof ContinueSuccessor
1268+
st instanceof ContinueSuccessor
12691269
or
12701270
ast instanceof GotoStmt and
1271-
c.getSuccessorType() instanceof GotoSuccessor
1272-
) and
1273-
(
1274-
not Input1::hasLabel(ast, _) and not c.hasLabel(_)
1271+
st instanceof GotoSuccessor
1272+
|
1273+
not Input1::hasLabel(ast, _) and
1274+
c = TSimpleAbruptCompletion(st)
12751275
or
12761276
exists(Input1::Label l |
12771277
Input1::hasLabel(ast, l) and
1278-
c.hasLabel(l)
1278+
c = TLabeledAbruptCompletion(st, l)
12791279
)
12801280
)
12811281
or
@@ -1319,20 +1319,19 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
13191319
n.(ExceptionalExitNodeImpl).getEnclosingCallable() = callable
13201320
)
13211321
or
1322-
exists(LoopStmt loop | ast = pragma[only_bind_into](loop).getBody() |
1322+
exists(LoopStmt loop, SuccessorType st | ast = pragma[only_bind_into](loop).getBody() |
13231323
(
1324-
c.getSuccessorType() instanceof BreakSuccessor and
1324+
st instanceof BreakSuccessor and
13251325
n.isAfter(loop)
13261326
or
1327-
c.getSuccessorType() instanceof ContinueSuccessor and
1327+
st instanceof ContinueSuccessor and
13281328
n.isAdditional(loop, loopHeaderTag())
13291329
) and
13301330
(
1331-
not c.hasLabel(_)
1331+
c = TSimpleAbruptCompletion(st)
13321332
or
1333-
exists(Input1::Label l |
1334-
c.hasLabel(l) and
1335-
(Input1::hasLabel(loop, l) or hasEnclosingLabel(loop, l))
1333+
exists(Input1::Label l | c = TLabeledAbruptCompletion(st, l) |
1334+
Input1::hasLabel(loop, l) or hasEnclosingLabel(loop, l)
13361335
)
13371336
)
13381337
)

0 commit comments

Comments
 (0)