zig/test/behavior
Andrew Kelley 336d0c97fe stage2: detection of comptime array literals
Introduce `validate_array_init_comptime`, similar to
`validate_struct_init_comptime` introduced in
713d2a9b3883942491b40738245232680877cc66.

`zirValidateArrayInit` is improved to detect comptime array literals and
emit AIR accordingly. This code is very similar to the changes
introduced in that same commit for `zirValidateStructInit`.

The C backend needed some improvements to continue passing the same set
of tests:
 * `resolveInst` for arrays now will add a local `static const` with the
   array value and so then `elem_val` instructions reference that local.
   It memoizes accesses using `value_map`, which is changed to use
   `Air.Inst.Ref` as the key rather than `Air.Inst.Index`.
 * This required a mechanism for writing to a "header" which is lines
   that appear at the beginning of a function body, before everything
   else.
 * dbg_stmt output comments rather than `#line` directives.
   TODO comment reproduced here:

We need to re-evaluate whether to emit these or not. If we naively emit
these directives, the output file will report bogus line numbers because
every newline after the #line directive adds one to the line.
We also don't print the filename yet, so the output is strictly unhelpful.
If we wanted to go this route, we would need to go all the way and not output
newlines until the next dbg_stmt occurs.
Perhaps an additional compilation option is in order?

`Value.elemValue` is improved to support `elem_ptr` values.
2022-01-13 22:13:44 -07:00
..
2021-10-26 16:43:18 -07:00
2021-10-28 17:33:05 -07:00
2022-01-10 21:01:00 +01:00
2022-01-10 21:01:00 +01:00
2021-08-30 18:50:07 -04:00
2022-01-08 14:30:11 -05:00
2022-01-08 14:30:11 -05:00
2021-11-22 03:21:31 +01:00
2021-11-27 00:27:52 -07:00
2021-11-27 00:27:52 -07:00
2022-01-07 00:06:06 -05:00
2022-01-07 00:06:06 -05:00
2021-11-27 00:27:52 -07:00
2021-11-26 23:17:01 -07:00
2022-01-07 00:06:06 -05:00
2021-07-26 20:05:48 -04:00
2022-01-08 14:01:28 +01:00
2021-12-28 23:22:09 -07:00
2021-12-28 23:22:09 -07:00
2022-01-03 02:09:54 +01:00
2022-01-03 02:09:54 +01:00
2022-01-03 02:09:54 +01:00
2021-11-27 00:27:52 -07:00
2021-12-28 23:22:09 -07:00
2021-12-27 15:30:31 -07:00
2022-01-07 00:06:06 -05:00