0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test
yvt d3ebd42865 Support taking extern pointers at comptime
This commit makes it possible to obtain pointers to `extern` variables
at comptime.

 - `ir_get_var_ptr` employs several checks to determine if the given
   variable is eligible for obtaining its pointer at comptime. This
   commit alters these checks to consider `extern` variables, which have
   runtime values, as eligible.

 - After this change, it's now possible for `render_const_val` to be
   called for `extern` variables. This commit modifies
   `render_const_val` to suppress the value generation for `extern`
   variables.

 - `do_code_gen` now creates `ZigValue::llvm_global` of `extern`
   variables before iterating through module-level variables so that
   other module-level variables can refer to them.

This solution is incomplete since there are several cases still
failing:

 - `global_var.array[n..m]`
 - `&global_var.array[i]`
 - `&global_var.inner_struct.value`
 - `&global_array[i]`

Closes #5349
History 2020-07-24 13:33:17 -07:00
..
src std lib API deprecations for the upcoming 0.6.0 release 2020-03-30 14:23:22 -04:00
stage1 fix comptime comparisons of different sized floats 2020-07-21 22:29:15 +03:00
stage2 Restructured arithmetic operations 2020-07-24 17:16:48 +02:00
standalone Support taking extern pointers at comptime 2020-07-24 13:33:17 -07:00
assemble_and_link.zig update std lib to new Target API 2020-02-28 14:51:54 -05:00
cli.zig Add 'no changes' test to zig fmt cli test 2020-06-20 22:21:23 -07:00
compare_output.zig test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
compile_errors.zig Support taking extern pointers at comptime 2020-07-24 13:33:17 -07:00
gen_h.zig @OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
run_translated_c.zig Translate-c fix rhs not cast on array access 2020-07-02 14:05:12 +00:00
runtime_safety.zig stage1: add missing runtime safety for @intCast unsigned -> signed of same bit count 2020-07-05 17:58:21 +02:00
stack_traces.zig update docs/tests for async/extern fn removal 2020-05-05 10:31:32 -06:00
standalone.zig Support taking extern pointers at comptime 2020-07-24 13:33:17 -07:00
tests.zig add behavior tests fro macro translations 2020-07-16 17:10:52 +03:00
translate_c.zig translate-c: support initializer list expr macros 2020-07-16 16:20:47 +03:00