Files
c3c/test/test_suite/compile_time/ct_switch_top_level.c3t
2022-01-24 00:01:54 +01:00

55 lines
1.2 KiB
C

// #target: x64-darwin
module test;
extern fn void printf(char*, ...);
macro tester()
{
$Type = int;
$switch $Type:
$case int:
printf("Hello\n");
int z = 0;
$default:
int j = 213;
$endswitch;
}
$switch bool.typeid:
$case int:
int oefke = 23;
$default:
int oeoekgokege = 343432;
$endswitch;
fn int main()
{
@tester();
@tester();
int i = 1;
return 1;
}
/* #expect: test.ll
source_filename = "test"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin-1"
@test.oeoekgokege = local_unnamed_addr global i32 343432, align 4
@.str = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
define i32 @main() #0 {
entry:
%z = alloca i32, align 4
%z1 = alloca i32, align 4
%i = alloca i32, align 4
call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0))
store i32 0, i32* %z, align 4
call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0))
store i32 0, i32* %z1, align 4
store i32 1, i32* %i, align 4
ret i32 1
}