mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Consistent length typedef.
First stab at initializers.
Change compound literal to Foo({ 1, 2 }) style.
Fixed up some tests.
Optimize the zero struct codegen.
Optimize union empty initializer.
Fix issues with unions. Added alignment to globals. Added some union tests.
Use puts to emit error messages during runtime. Fixup of int[] -> int* style conversions.
Fix implicit conversion of int[3]* -> int*
Fix int[] size. Use () to invoke the length of a subarray. Fix taking a slice of a pointer. Limit the number of members in a struct.
Fixes to vararg using debug and cleanups to slices.
31 lines
781 B
Plaintext
31 lines
781 B
Plaintext
// #target: x64_darwin
|
|
|
|
struct Test
|
|
{
|
|
int x;
|
|
}
|
|
|
|
Test foo = {};
|
|
|
|
extern func void blorg(Test t);
|
|
|
|
func Test creator()
|
|
{
|
|
blorg(Test({}));
|
|
return Test({});
|
|
}
|
|
|
|
// #expect: literal_load.ll
|
|
|
|
%literal = alloca %literal_load.Test, align 4
|
|
%literal1 = alloca %literal_load.Test, align 4
|
|
%0 = bitcast %literal_load.Test* %literal to i8*
|
|
call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 0, i64 4, i1 false)
|
|
%1 = bitcast %literal_load.Test* %literal to i32*
|
|
%coerced = load i32, i32* %1, align 4
|
|
call void @blorg(i32 %coerced)
|
|
%2 = bitcast %literal_load.Test* %literal1 to i8*
|
|
call void @llvm.memset.p0i8.i64(i8* align 4 %2, i8 0, i64 4, i1 false)
|
|
%3 = bitcast %literal_load.Test* %literal1 to i32*
|
|
%coerced2 = load i32, i32* %3, align 4
|
|
ret i32 %coerced2 |