aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
AgeCommit message (Collapse)Author
2022-08-10stage2: remove destroyed functions from mapsAndrew Kelley
This is likely the cause of the flaky test failures in master branch. Since we have some test coverage for incremental compilation, it's not OK to leave proper memory management of Fn objects as "TODO".
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: correct node offset of nested declarationsVeikka Tuominen
2022-08-05Merge pull request #12300 from antlilja/getParamNameVeikka Tuominen
Replace param_names and anytype_args fields inside of Fn with functions
2022-08-01stage2: better source location for var declsVeikka Tuominen
2022-08-01Removed anytype_args field from Fnantlilja
anytype_args field was replaced with isAnytypeParam function.
2022-08-01Removed param_names from Fn inside Module.zigantlilja
Removed the copy of param_names inside of Fn and changed to implementation of getParamName to fetch to parameter name from the ZIR. The signature of getParamName was also changed to take an additional *Module argument.
2022-07-29stage2: handle tuple init edge casesVeikka Tuominen
2022-07-29stage2: add error for comptime control flow in runtime blockVeikka Tuominen
2022-07-28stage2: ensure 'std', 'builtin', and 'root' is always available to `@import`Meghan
2022-07-27Merge pull request #12256 from Vexu/stage2Andrew Kelley
stage2 typeInfo UAF fix + more
2022-07-27Sema: copy fn param ty in `zirTypeInfo`Veikka Tuominen
Closes #12247
2022-07-27Module: fix inverted conditionLordMZTE
2022-07-27Module: use path.isSepLordMZTE
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-07-27Module: fix error message importing file starting with root pathLordMZTE
2022-07-26Sema: better source location for builtin optionsVeikka Tuominen
2022-07-26Module: improve handling of errors in `@call` argumentsVeikka Tuominen
2022-07-25Sema: `analyzeInlineCallArg` needs a block for the arg and the paramVeikka Tuominen
2022-07-24stage2: don't skip liveness or codegen if -femit-asm is suppliedAndrew Kelley
Fixes Godbolt's CLI usage of Zig.
2022-07-24stage2: implement `noinline fn`Meghan
2022-07-23Sema: validate duplicate fields in anon structsVeikka Tuominen
2022-07-23Sema: add default value here note to invalid comptime field store errorVeikka Tuominen
2022-07-23Sema: bad union field access safetyVeikka Tuominen
2022-07-21Sema: better source location for function call argsVeikka Tuominen
2022-07-21Sema: better function parameter source locationVeikka Tuominen
2022-07-21Sema: better source location for incompatible capture groupVeikka Tuominen
2022-07-21Sema: more union and enum tag type validationVeikka Tuominen
2022-07-21Sema: validate function parameter types and return typeVeikka Tuominen
2022-07-21Sema: validate function pointer alignmentVeikka Tuominen
2022-07-21Sema: explain why comptime is neededVeikka Tuominen
2022-07-21stage2: better pointer source locationVeikka Tuominen
2022-07-15Module: improve source spans for initializers and var typesVeikka Tuominen
```zig const U = union { foo: u32, bar: u32 }; test { var a = U{ .foo = 1213, .bar = 1123 }; _ = a; } test { var a: (123 + 5238094) = 0; _ = a; } ``` before: ``` :30: note: additional initializer here var a = U{ .foo = 1213, .bar = 1123 }; ^~~ :12: error: expected type 'type', found 'comptime_int' var a: (123 + 5238094) = 0; ^ ``` after: ``` :30: note: additional initializer here var a = U{ .foo = 1213, .bar = 1123 }; ~^~~~~~~~~~ :12: error: expected type 'type', found 'comptime_int' var a: (123 + 5238094) = 0; ^~~~~~~~~~~~~~~ ```
2022-07-15Compilation: point caret in error message at the main tokenVeikka Tuominen
2022-07-14stage2: point to error location using spansVeikka Tuominen
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-12stage2: handle parser notes in a more general wayVeikka Tuominen
2022-07-12parser: add helpful error for C style container declarationsVeikka Tuominen
```zig // a.zig struct Foo { a: u32, }; ``` before: ``` a.zig:1:1: error: expected test, comptime, var decl, or container field, found 'struct' struct Foo { ^ ``` after: ``` a.zig:1:8: error: 'struct Foo' is invalid struct Foo { ^ a.zig:1:8: note: to declare a container do 'const Foo = struct' struct Foo { ^ ```
2022-07-07Sema: improve slice source locationsVeikka Tuominen
2022-07-07Module: add `.node_offset_un_op`Veikka Tuominen
2022-06-30Sema: improve auto generated union enum nameVeikka Tuominen
2022-06-27Sema: honor the --test-filter flagAndrew Kelley
2022-06-11stage2: improve debugging toolsVeikka Tuominen
llvm: dump failed module when -femit-llvm-ir set print_air: * print fully qualified name * use Type.fmt and Value.fmtValue, fmtDebug is useless TypedValue * handle anon structs and tuples * fix bugs
2022-06-09stage2: use std.debug.Trace only when explicitly enabledAndrew Kelley
Because it bumps up the stack space requirements, which is making a test case fail on aarch64 drone CI.
2022-06-09std.debug.Trace: improve APIAndrew Kelley
Now `std.debug.Trace` is a concrete type with pre-chosen defaults. `std.debug.ConfigurableTrace` can be used for more advanced cases.
2022-06-09introduce std.debug.TraceAndrew Kelley
And use it to debug a LazySrcLoc in stage2 that is set to a bogus value. The actual fix in this commit is: ```diff - try sema.emitBackwardBranch(&child_block, call_src); + try sema.emitBackwardBranch(block, call_src); ```
2022-06-06stage2: use correct type (u29) for alignmentVeikka Tuominen
2022-05-30stage2: add missing data to ZIR encoding of functionsAndrew Kelley
The main purpose of this commit is to prepare to implement support for callconv(), align(), linksection(), and addrspace() annotations on generic functions where the provided expression depends on comptime parameters (making the function generic). It's a rather involved change, so this commit only makes the necessary changes to AstGen without regressing any behavior, and a follow-up commit can finish the task by making the enhancements to Sema. By my quick estimation, the new encoding for functions is a negligible improvement - along the lines of 0.005% fewer total ZIR bytes on average. Still, it's nice that this commit, while adding more data into ZIR, actually ends up reducing the storage size thanks to a slightly more sophisticated encoding. Zir.Inst.ExtendedFunc is renamed to Zir.Inst.FuncFancy to eliminate confusion about it being an extended instruction (it used to be but is no longer). The encoding for this instruction is completely reworked. The encoding for Zir.Inst.Func is also changed slightly - when the return type body length is 1, then only a Zir.Inst.Ref is provided; not a full body. linksection() and addrspace() are now communicated via func_fancy ZIR instruction rather than as part of the corresponding decl. This allows their expressions to observe comptime parameters.
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-25Sema: generic function instantiations inherit branch quotaAndrew Kelley
2022-05-24stage2: string literal interningAndrew Kelley
This is a temporary addition to stage2 in order to match stage1 behavior, however the end-game once the lang spec is settled will be to use a global InternPool for comptime memoized objects, making this behavior consistent across all types, not only string literals. Or, we might decide to not guarantee string literals to have equal comptime pointers, in which case this commit can be reverted.