Skip to content

Commit 5390425

Browse files
paldepindCopilot
andcommitted
Unified: Accept defer test results
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 66ebeec commit 5390425

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎unified/ql/lib/codeql/unified/internal/Ast.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ module Unified {
534534
final override string getAPrimaryQlClass() { result = "DeferStmt" }
535535

536536
/** Gets the node corresponding to the field `body`. */
537-
final F::Block getBody() { unified_defer_stmt_def(this, result) }
537+
final F::Expr getBody() { unified_defer_stmt_def(this, result) }
538538

539539
/** Gets a field or child node of this node. */
540540
final override F::AstNode getAFieldOrChild() { unified_defer_stmt_def(this, result) }

‎unified/ql/lib/unified.dbscheme‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ unified_continue_expr_def(
402402

403403
unified_defer_stmt_def(
404404
unique int id: @unified_defer_stmt,
405-
int body: @unified_block ref
405+
int body: @unified_expr ref
406406
);
407407

408408
#keyset[unified_destructor_declaration, index]

‎unified/ql/test/library-tests/controlflow/basicblock-slices.expected‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,14 @@
129129
| 152 | cfg.swift:152:7:152:18 | Block | 'Block -V false -^ ReturnExpr' |
130130
| 168 | cfg.swift:168:1:184:1 | FunctionDeclaration | 'FunctionDeclaration' |
131131
| 168 | cfg.swift:168:16:168:16 | x | 'x -> Block' |
132-
| 170 | cfg.swift:170:3:172:3 | | '' |
133-
| 174 | cfg.swift:174:3:176:3 | | '' |
134-
| 178 | cfg.swift:178:3:183:3 | | '' |
132+
| 170 | cfg.swift:170:3:172:3 | DeferStmt | 'DeferStmt -V Block' |
133+
| 171 | cfg.swift:171:5:171:9 | print | 'print -> Argument -V "4" -^ print(...)' |
134+
| 174 | cfg.swift:174:3:176:3 | DeferStmt | 'DeferStmt -V Block' |
135+
| 175 | cfg.swift:175:5:175:9 | print | 'print -> Argument -V "3" -^ print(...)' |
136+
| 178 | cfg.swift:178:3:183:3 | DeferStmt | 'DeferStmt -V Block' |
137+
| 179 | cfg.swift:179:5:179:9 | print | 'print -> Argument -V "1" -^ print(...)' |
138+
| 180 | cfg.swift:180:6:182:5 | DeferStmt | 'DeferStmt -V Block' |
139+
| 181 | cfg.swift:181:7:181:11 | print | 'print -> Argument -V "2" -^ print(...)' |
135140
| 186 | cfg.swift:186:1:198:1 | FunctionDeclaration | 'FunctionDeclaration' |
136141
| 186 | cfg.swift:186:9:186:9 | x | 'x -> Block' |
137142
| 187 | cfg.swift:187:3:197:3 | IfExpr | 'IfExpr -V x -> 2 -^ ... > ...' |

0 commit comments

Comments
 (0)