aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
AgeCommit message (Collapse)Author
2022-09-12remove pointless discardsAndrew Kelley
2022-09-12stage2: change how defers are stored in ZirVeikka Tuominen
Storing defers this way has the benefits that the defer doesn't get analyzed multiple times in AstGen, it takes up less space, and it makes Sema aware of defers allowing for 'unreachable else prong' error on error sets in generic code. The disadvantage is that it is a bit more complex and errdefers with payloads now emit a placeholder instruction (but those are rare). Sema.zig before: Total ZIR bytes: 3.7794370651245117MiB Instructions: 238996 (2.051319122314453MiB) String Table Bytes: 89.2802734375KiB Extra Data Items: 430144 (1.640869140625MiB) Sema.zig after: Total ZIR bytes: 3.3344192504882812MiB Instructions: 211829 (1.8181428909301758MiB) String Table Bytes: 89.2802734375KiB Extra Data Items: 374611 (1.4290275573730469MiB)
2022-09-02AstGen: use reachableExpr for try operandVeikka Tuominen
Closes #12248
2022-08-30Sema: shift of comptime int with runtime valueVeikka Tuominen
Closes #12290
2022-08-28AstGen: add error for named function typeVeikka Tuominen
Closes #12660
2022-08-24Merge pull request #12623 from Vexu/stage2-fixesAndrew Kelley
Stage2 fixes
2022-08-24AstGen: make root decls relative to beginning of fileVeikka Tuominen
Closes #12610
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-18AstGen: disallow leading zeroes in int literals and int typeszooster
This makes `0123` and `u0123` etc. illegal. I'm now confident that this is a good change because I actually caught two C header translation mistakes in `haiku.zig` with this. Clearly, `0123` being octal in C (TIL) can cause confusion, and we make this easier to read by requiring `0o` as the prefix and now also disallowing leading zeroes in integers. For consistency and because it looks weird, we disallow it for integer types too (e.g. `u0123`). Fixes #11963 Fixes #12417
2022-08-17Sema: allow empty enums and unionsVeikka Tuominen
2022-08-16AstGen: detect declarations shadowing localsVeikka Tuominen
Closes #9355
2022-08-13stage2 astgen: Use `rl` semantics for `@Type`Cody Tapscott
Resolves #12430.
2022-08-10stage2: Implement explicit backing integers for packed structsIsaac Freund
Now the backing integer of a packed struct type may be explicitly specified with e.g. `packed struct(u32) { ... }`.
2022-08-09stage2: generate call arguments in separate blocksVeikka Tuominen
2022-08-09Merge pull request #12383 from ziglang/stage2-stack-tracesAndrew Kelley
several improvements to error return tracing in the self-hosted compiler
2022-08-09stage2: correct node offset of nested declarationsVeikka Tuominen
2022-08-08AstGen: emit debug stmt for tryAndrew Kelley
This improves the following test case: ```zig pub fn main() !void { try foo(); } fn foo() !void { return error.Bad; } ``` The error return trace now points to the `try` token instead of pointing to the foo() function call, matching stage1. Closes #12308.
2022-08-08AstGen: avoid multiple dbg_stmt instructions in a rowAndrew Kelley
This is purely an optimization to emit fewer ZIR instructions.
2022-08-08stage2: error return tracing handles ret betterAndrew Kelley
Sema: insert an error return trace frame when appropriate when analyzing ret_load. Also optimize the instructions to avoid an unnecessary block sent to the backends. AstGen: always emit a dbg_stmt for return expressions, in between the defer instructions and the return instruction. This improves the following test case: ```zig pub fn main() !void { return foo(); } fn foo() !void { return error.Bad; } ``` The error return trace now points to the return token instead of pointing to the foo() function call, matching stage1.
2022-08-08stage2: pass anon name strategy to reifyVeikka Tuominen
2022-08-06stage2: add a helpful error for when async is usedVeikka Tuominen
2022-08-03AstGen: better source location for if/while condition unwrappingVeikka Tuominen
2022-08-03AstGen: check loop bodies and else branches for unused resultVeikka Tuominen
2022-08-03AstGen: add error for break/continue out of defer expressionVeikka Tuominen
2022-08-01stage2: better source location for var declsVeikka Tuominen
2022-07-29stage2: handle tuple init edge casesVeikka Tuominen
2022-07-29stage2: add error for comptime control flow in runtime blockVeikka Tuominen
2022-07-27AstGen: fix ref instruction injection for functionsAndrew Kelley
For the expressions regarding return type, alignment, parameter type, etc.
2022-07-27AstGen: add `dbg_stmt`s for `unreachable` and `@panic`Veikka Tuominen
Closes #12249
2022-07-26AstGen: disable null bytes and empty stings in some placesVeikka Tuominen
Namely: * test names * identifiers * library names * import strings
2022-07-24stage2: implement `noinline fn`Meghan
2022-07-23Sema: validate duplicate fields in anon structsVeikka Tuominen
2022-07-23AstGen: make comptime fields in packed and extern structs compile errorsVeikka Tuominen
2022-07-23Sema: bad union field access safetyVeikka Tuominen
2022-07-23move passing safety tests to stage2Veikka Tuominen
2022-07-21AstGen: add error for fields in opaque typesVeikka Tuominen
2022-07-21Sema: more union and enum tag type validationVeikka Tuominen
2022-07-21stage2: better pointer source locationVeikka Tuominen
2022-07-13AstGen: fix loop control flow applying to wrong loopAndrew Kelley
In the case of 'continue' or 'break' inside the 'else' block of a 'while' or 'for' loop. Closes #12109
2022-07-13stage2: lower each struct field type, align, init separatelyAndrew Kelley
Previously, struct types, alignment values, and initialization expressions were all lowered into the same ZIR body, which caused false positive "depends on itself" errors when the initialization expression depended on the size of the struct. This also uses ResultLoc.coerced_ty for struct field alignment and initialization values. The resulting ZIR encoding ends up being roughly the same, neither smaller nor larger than previously. Closes #12029
2022-07-07Merge pull request #12016 from Vexu/stage2-compile-errorsAndrew Kelley
Stage2 compile error improvements
2022-07-07AstGen: fix catch payoad not checking for shadowingemma
2022-07-07stage2: move C pointer allowzero error to AstGenVeikka Tuominen
2022-07-07Sema: improve array source locationVeikka Tuominen
2022-07-07Module: add `.node_offset_un_op`Veikka Tuominen
2022-07-07Sema: panic at comptime + misc error message improvementsVeikka Tuominen
2022-07-07AstGen: move error_to_int, int_to_error and select to extendedVeikka Tuominen
2022-07-01AstGen: use elem_{ptr,val}_node for array access syntaxVeikka Tuominen
2022-07-01Sema: validate deref operator type and valueVeikka Tuominen
2022-06-30Sema: add source location to coerce result ptr, fix negation errorVeikka Tuominen