Moved examples around. Updated (and corrected) const initialization. Removed "in" keyword. Added "member" attribute domain. Many fixes in struct padding and alignment and tests. Fixed extern global.

This commit is contained in:
Christoffer Lerno
2021-01-24 00:52:48 +01:00
committed by Christoffer Lerno
parent 564c93700e
commit 3a24fbfa6d
67 changed files with 1930 additions and 671 deletions

View File

@@ -0,0 +1,33 @@
module structo;
struct Foo
{
int foo;
long bar;
}
usize x = Foo.sizeof;
Foo foo1 = { 1, 2 };
Foo foo2 = { .foo = 2 };
Foo foo3 = { .bar = 3 };
Foo foo4 = { .bar = 4, .foo = 4, .bar = 1 };
Foo foo5 = {};
Foo foo6;
const Foo FOO7 = { 1, 2 };
Foo foo8 = FOO7;
// #expect: struct_const_construct_simple.ll
%structo.Foo = type { i32, i64 }
@Foo = linkonce_odr constant i8 1
@x = protected global i64 16, align 8
@foo1 = protected global %structo.Foo { i32 1, i64 2 }, align 8
@foo2 = protected global %structo.Foo { i32 2, i64 0 }, align 8
@foo3 = protected global %structo.Foo { i32 0, i64 3 }, align 8
@foo4 = protected global %structo.Foo { i32 4, i64 1 }, align 8
@foo5 = protected global %structo.Foo zeroinitializer, align 8
@foo6 = protected global %structo.Foo zeroinitializer, align 8
@FOO7 = protected constant %structo.Foo { i32 1, i64 2 }, align 8
@foo8 = protected global %structo.Foo { i32 1, i64 2 }, align 8