0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test/behavior
Andrew Kelley 6d6cf59847 stage2: support nested structs and arrays and sret
* Add AIR instructions: ret_ptr, ret_load
   - This allows Sema to be blissfully unaware of the backend's decision
     to implement by-val/by-ref semantics for struct/union/array types.
     Backends can lower these simply as alloc, load, ret instructions,
     or they can take advantage of them to use a result pointer.
 * Add AIR instruction: array_elem_val
   - Allows for better codegen for `Sema.elemVal`.
 * Implement calculation of ABI alignment and ABI size for unions.
 * Before appending the following AIR instructions to a block,
   resolveTypeLayout is called on the type:
   - call - return type
   - ret - return type
   - store_ptr - elem type
 * Sema: fix memory leak in `zirArrayInit` and other cleanups to this
   function.
 * x86_64: implement the full x86_64 C ABI according to the spec
 * Type: implement `intInfo` for error sets.
 * Type: implement `intTagType` for tagged unions.

The Zig type tag `Fn` is now used exclusively for function bodies.
Function pointers are modeled as `*const T` where `T` is a `Fn` type.
 * The `call` AIR instruction now allows a function pointer operand as
   well as a function operand.
 * Sema now has a coercion from function body to function pointer.
 * Function type syntax, e.g. `fn()void`, now returns zig tag type of
   Pointer with child Fn, rather than Fn directly.
   - I think this should probably be reverted. Will discuss the lang
     specs before doing this. Idea being that function pointers would
     need to be specified as `*const fn()void` rather than `fn() void`.

LLVM backend:
 * Enable calling the panic handler (previously this just
   emitted `@breakpoint()` since the backend could not handle the panic
   function).
 * Implement sret
 * Introduce `isByRef` and implement it for structs and arrays. Types
   that are `isByRef` are now passed as pointers to functions, and e.g.
   `elem_val` will return a pointer instead of doing a load.
 * Move the function type creating code from `resolveLlvmFunction` to
   `llvmType` where it belongs; now there is only 1 instance of this
   logic instead of two.
 * Add the `nonnull` attribute to non-optional pointer parameters.
 * Fix `resolveGlobalDecl` not using fully-qualified names and not using
   the `decl_map`.
 * Implement `genTypedValue` for pointer-like optionals.
 * Fix memory leak when lowering `block` instruction and OOM occurs.
 * Implement volatile checks where relevant.
History 2021-10-11 11:39:12 -07:00
..
bugs stage2: support nested structs and arrays and sret 2021-10-11 11:39:12 -07:00
hasdecl move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
import move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
namespace_depends_on_compile_var move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
pub_enum move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
usingnamespace std: fix regressions from this branch 2021-09-01 17:54:07 -07:00
align.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
alignof.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
array.zig stage2: support nested structs and arrays and sret 2021-10-11 11:39:12 -07:00
array_stage1.zig stage2: support nested structs and arrays and sret 2021-10-11 11:39:12 -07:00
asm.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
async_fn.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
atomics.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
await_struct.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
basic.zig stage2: implement @memset and @memcpy builtins 2021-09-24 17:33:06 -07:00
bit_shifting.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
bitcast.zig stage2: fix comptime @bitCast 2021-10-04 23:30:04 -07:00
bitcast_stage1.zig stage2: fix comptime @bitCast 2021-10-04 23:30:04 -07:00
bitreverse.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
bool.zig Sema: implement comptime variables 2021-08-01 12:36:04 -07:00
byteswap.zig re-enable mips behavior tests for vectors 2021-09-01 15:41:29 -07:00
byval_arg_var.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
call.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
call_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
cast.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
cast_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
comptime_memory.zig Add comptime memory tests 2021-08-30 18:50:07 -04:00
const_slice_child.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
defer.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
defer_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
enum.zig stage2: implement runtime @intToEnum 2021-10-05 21:38:47 -07:00
enum_stage1.zig stage2: enum fixes 2021-10-05 23:05:14 -07:00
error.zig stage1: remove incorrect compile error for var redeclaration 2021-08-24 22:35:37 -07:00
eval.zig stage2: fix comptime_float negation 2021-10-07 17:11:27 -07:00
eval_stage1.zig stage2: fix comptime_float negation 2021-10-07 17:11:27 -07:00
field_parent_ptr.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
floatop.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
fn.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
fn_delegation.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
fn_in_struct_in_comptime.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
for.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
for_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
generics.zig Stage 2: Support inst.func() syntax (#9827) 2021-09-28 12:00:35 -05:00
generics_stage1.zig Stage 2: Support inst.func() syntax (#9827) 2021-09-28 12:00:35 -05:00
hasdecl.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
hasfield.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
if.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
if_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
import.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
incomplete_struct_param_tld.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
inttoptr.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
ir_block_deps.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
math.zig stage2: implement @clz and @ctz 2021-09-28 22:38:51 -07:00
math_stage1.zig stage2: implement @clz and @ctz 2021-09-28 22:38:51 -07:00
maximum_minimum.zig minimum/maximum builtins 2021-07-26 20:41:00 -04:00
member_func.zig Stage 2: Support inst.func() syntax (#9827) 2021-09-28 12:00:35 -05:00
merge_error_sets.zig move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
misc.zig stage2: implement @memset and @memcpy builtins 2021-09-24 17:33:06 -07:00
muladd.zig freestanding libc: export fmal 2021-10-05 16:56:46 -07:00
namespace_depends_on_compile_var.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
null.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
optional.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
pointers.zig stage2: pass some pointer tests 2021-08-07 15:46:53 -07:00
pointers_stage1.zig stage2: pass some pointer tests 2021-08-07 15:46:53 -07:00
popcount.zig re-enable mips behavior tests for vectors 2021-09-01 15:41:29 -07:00
ptrcast.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
pub_enum.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
ref_var_in_if_after_if_2nd_switch_prong.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
reflection.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
saturating_arithmetic.zig stage2: fix Type max/min int calculation 2021-10-04 12:23:49 -07:00
select.zig Add @select 2021-07-26 20:05:48 -04:00
shuffle.zig re-enable mips behavior tests for vectors 2021-09-01 15:41:29 -07:00
sizeof_and_typeof.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
sizeof_and_typeof_stage1.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
slice.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
slice_sentinel_comptime.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
src.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
struct.zig stage2: support nested structs and arrays and sret 2021-10-11 11:39:12 -07:00
struct_contains_null_ptr_itself.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
struct_contains_slice_of_itself.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
struct_stage1.zig stage2: support nested structs and arrays and sret 2021-10-11 11:39:12 -07:00
switch.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
switch_prong_err_enum.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
switch_prong_implicit_cast.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
switch_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
this.zig Stage2: Implement comptime closures and the This builtin (#9823) 2021-09-23 13:17:06 -04:00
translate_c_macros.h translate-c: handle macros that cast to cv void 2021-08-06 09:10:50 +03:00
translate_c_macros.zig stage2: various fixes to cImport, sizeOf and types to get tests passing 2021-09-20 20:51:31 -07:00
translate_c_macros_stage1.zig stage2: various fixes to cImport, sizeOf and types to get tests passing 2021-09-20 20:51:31 -07:00
truncate.zig Fix unexpected truncation behavior with comptime_int larger than u64 range (#9303) 2021-07-06 12:42:18 +03:00
try.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
tuple.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
type.zig Address Spaces: Pointer and function info in @Type 2021-09-20 02:29:04 +02:00
type_info.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
typename.zig stage1: fix anon struct naming in certain cases 2021-07-28 18:17:11 -04:00
undefined.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
underscore.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
union.zig stage2: implement union coercion to its own tag 2021-09-27 23:11:00 -07:00
union_stage1.zig move tagged union behavior tests to the appropriate place 2021-10-05 21:07:36 -07:00
union_with_members.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
usingnamespace.zig stage2: first pass at implementing usingnamespace 2021-09-01 17:54:06 -07:00
usingnamespace_stage1.zig std: fix regressions from this branch 2021-09-01 17:54:07 -07:00
var_args.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
vector.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
void.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
wasm.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
while.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
while_stage1.zig AstGen: fix while and for with unreachable bodies 2021-10-02 20:15:03 -07:00
widening.zig stage2: enum fixes 2021-10-05 23:05:14 -07:00