Files
c3c/test/test_suite/compile_time/ct_for.c3t
2023-03-20 01:03:54 +01:00

33 lines
731 B
C

// #target: macos-x64
module test;
extern fn void printf(char*, ...);
fn void main()
{
$for (var $i = 0; $i < 3; $i++)
printf("Foo %d\n", $i);
$endfor;
$for ($i = 0, var $j = 100; $i < 4;)
printf("Foo %d %d\n", $i++, $j--);
$endfor;
}
/* #expect: test.ll
define void @test.main() #0 {
entry:
call void (ptr, ...) @printf(ptr @.str, i32 0)
call void (ptr, ...) @printf(ptr @.str.1, i32 1)
call void (ptr, ...) @printf(ptr @.str.2, i32 2)
call void (ptr, ...) @printf(ptr @.str.3, i32 0, i32 100)
call void (ptr, ...) @printf(ptr @.str.4, i32 1, i32 99)
call void (ptr, ...) @printf(ptr @.str.5, i32 2, i32 98)
call void (ptr, ...) @printf(ptr @.str.6, i32 3, i32 97)
ret void
}