diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-12 21:26:59 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-12 21:38:46 -0700 |
| commit | a3104a4a78089f3260c0dd3f4a96012c6d73a63b (patch) | |
| tree | 63d73840d9d48d09cd27c3fef5e52f051a2dc4bd /src/codegen/c.zig | |
| parent | 7f006287ae89b97ff0ca977f64744ea344ec94fd (diff) | |
| download | zig-a3104a4a78089f3260c0dd3f4a96012c6d73a63b.tar.gz zig-a3104a4a78089f3260c0dd3f4a96012c6d73a63b.zip | |
stage2: fix comptime stores and sentinel-terminated arrays
* ZIR: the `array_type_sentinel` now has a source node attached to it
for proper error reporting.
* Refactor: move `Module.arrayType` to `Type.array`
* Value: the `bytes` and `array` tags now include the sentinel, if the
type has one. This simplifies comptime evaluation logic.
* Sema: fix `zirStructInitEmpty` to properly handle when the type is
void or a sentinel-terminated array. This handles the syntax `void{}`
and `[0:X]T{}`.
* Sema: fix the logic for reporting "cannot store runtime value in
compile time variable" as well as for emitting a runtime store when a
pointer value is comptime known but it is a global variable.
* Sema: implement elemVal for double pointer to array. This can happen
with this code for example: `var a: *[1]u8 = undefined; _ = a[0];`
* Sema: Rework the `storePtrVal` function to properly handle nested
structs and arrays.
- Also it now handles comptime stores through a bitcasted pointer.
When the pointer element type and the type according to the Decl
don't match, the element value is bitcasted before storage.
Diffstat (limited to 'src/codegen/c.zig')
0 files changed, 0 insertions, 0 deletions
