Skip to content

Commit e0ac3d5

Browse files
committed
C++: Add a test with compiler-generated initializers from C++11 ranged for loops.
1 parent 3d1a64d commit e0ac3d5

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

cpp/ql/test/library-tests/compiler_generated/compilerGenerated.expected

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,28 @@
2525
| cpp.cpp:23:37:23:37 | return ... | Stmt |
2626
| cpp.cpp:23:37:23:37 | return ... | Stmt |
2727
| cpp.cpp:27:1:27:1 | return ... | Stmt |
28+
| cpp.cpp:31:5:31:5 | (__begin) | Variable |
29+
| cpp.cpp:31:5:31:5 | (__end) | Variable |
30+
| cpp.cpp:31:5:31:5 | (__range) | Variable |
31+
| cpp.cpp:31:5:33:5 | declaration | Stmt |
32+
| cpp.cpp:31:5:33:5 | declaration | Stmt |
33+
| cpp.cpp:31:5:33:5 | declaration | Stmt |
34+
| cpp.cpp:31:17:31:18 | (reference to) | Expr |
35+
| cpp.cpp:31:17:31:18 | vs | Expr |
36+
| cpp.cpp:34:1:34:1 | return ... | Stmt |
37+
| file://:0:0:0:0 | (__begin) | Expr |
38+
| file://:0:0:0:0 | (__begin) | Expr |
39+
| file://:0:0:0:0 | (__begin) | Expr |
40+
| file://:0:0:0:0 | (__end) | Expr |
41+
| file://:0:0:0:0 | (__range) | Expr |
42+
| file://:0:0:0:0 | (reference dereference) | Expr |
43+
| file://:0:0:0:0 | (reference dereference) | Expr |
44+
| file://:0:0:0:0 | * ... | Expr |
45+
| file://:0:0:0:0 | ... + ... | Expr |
46+
| file://:0:0:0:0 | array to pointer conversion | Expr |
47+
| file://:0:0:0:0 | array to pointer conversion | Expr |
48+
| file://:0:0:0:0 | initializer for (__begin) | Initializer |
49+
| file://:0:0:0:0 | initializer for (__end) | Initializer |
50+
| file://:0:0:0:0 | initializer for (__range) | Initializer |
2851
| file://:0:0:0:0 | operator delete | Function |
2952
| file://:0:0:0:0 | operator new | Function |

cpp/ql/test/library-tests/compiler_generated/cpp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ void parameter_pack(Args... args) { }
2424

2525
void test_parameter_pack() {
2626
parameter_pack();
27+
}
28+
29+
void ranged_for() {
30+
int vs[] = {1, 2, 3};
31+
for(int i : vs) {
32+
33+
}
2734
}

0 commit comments

Comments
 (0)