aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
AgeCommit message (Collapse)Author
2022-10-05fix(text): hyphenate "comptime" adjectivesr00ster91
2022-10-05Merge pull request #13071 from ziglang/resolve-cache-filesAndrew Kelley
stage2: resolve file before putting them into cache
2022-10-05Fix all std lib tests being run for any file within the std packageRyan Liptak
Before this commit: ``` $ zig test lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib 2170 passed; 37 skipped; 0 failed. ``` After this commit: ``` $ zig test lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib All 45 tests passed. ``` This matches stage1 behavior: ``` $ zig test -fstage1 lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib All 45 tests passed. ``` All tests are still run if `zig test` is run directly on `lib/std/std.zig`: ``` $ zig test lib/std/std.zig --main-pkg-path lib/std --zig-lib-dir lib 2170 passed; 37 skipped; 0 failed. ``` `zig build test-std` is unaffected by this change. Closes #12926
2022-10-05stage2: resolve file before putting them into cacheAndrew Kelley
This was an accidental misuse of the Cache API which intends to call resolve on all file paths going into it. This one callsite was failing to do that; fixed now. Fixes relative file paths from making it into the global cache manifest. See #13050
2022-10-03Merge pull request #12979 from Vexu/inline-switchAndrew Kelley
Implement inline switch cases
2022-10-01Sema: avoid undefined fields in file struct declsJacob Young
Fixes original comment of #12399
2022-09-30stage2: improve error message for missing member in file root structVeikka Tuominen
* the root struct decl name is fully qualified this prevents error messages containing 'main.main' * avoid declared here note when file struct is missing a member It always points at the start of the file which might contain another container misleading the user.
2022-09-27Sema: implement non-special inline switch prongsVeikka Tuominen
2022-09-15stage2: implement referenced by trace for error messagesVeikka Tuominen
Closes #7668 Closes #12141
2022-09-08Sema: fix UAF in zirClosureGetVeikka Tuominen
Previously if a decl failed its capture scope would be deallocated and set to undefined which would then lead to invalid dereference in `zirClosureGet`. To avoid this set the capture scope to a special failed state and fail the current decl with dependency failure if the failed state is encountered in `zirClosureGet`. Closes #12433 Closes #12530 Closes #12593
2022-09-07build-exe: allow combination of -fno-emit-bin and --verbose-airbfredl
Currently, `zig build-exe -fno-emit-bin --verbose-air src/main.zig` results in no output at all. With this refactor, it dumps AIR and then exits without invoking LLVM, as expected
2022-09-02Sema: remove unused src param from typeRequiresComptimeVeikka Tuominen
2022-08-30Sema: prevent access of undefined fieldsAndrew Kelley
When instantiating a generic function, there is a period of time where the function is inserted into monomorphed_funcs map, but is not yet initialized. Despite semantic analysis being single-threaded, generic function instantiation can happen recursively, meaning that the hash and equality functions for monomorphed_funcs entries are potentially invoked for an uninitialized function. This problem was mitigated by pre-setting the hash field on the newly allocated function, however it did not solve the problem for hash collisions in which case the equality function would be invoked. That it was solved for hash() but not eql() explains why the problem was difficult to observe. I tested this patch by temporarily sabotaging the hash and making it always return 0. This fix is centered on adding a new field to Module.Fn which is the one checked by eql() and is populated pre-initialization. closes #12643
2022-08-30coff: add missing bits required for minimal PE exampleJakub Konka
2022-08-30coff: reorganize the linkerJakub Konka
2022-08-24stage2: explicitly tagged enums no longer have one possible valueAndrew Kelley
Previously, Zig had inconsistent semantics for an enum like this: `enum(u8){zero = 0}` Although in theory this can only hold one possible value, the tag `zero`, Zig no longer will treat the type this way. It will do loads and stores, as if the type has runtime bits. Closes #12619 Tests passed locally: * test-behavior * test-cases
2022-08-24stage2: fix generic function cleanupAndrew Kelley
When removing generic function instantiations from monomorphed_funcs, we need to first make sure the function is generic, otherwise the hash map tries to access the `hash` field of the function which is undefined. closes #12614
2022-08-22Sema: fix parameter of type 'T' must be comptime errorVeikka Tuominen
Closes #12519 Closes #12505
2022-08-19LLVM: add DLL export attributeAndrew Kelley
This was present in stage1 but missing from self-hosted.
2022-08-18improved ABI alignment/size for >= 128-bit integersAndrew Kelley
* riscv64: adjust alignment and size of 128-bit integers. * take ofmt=c into account for ABI alignment of 128-bit integers and structs. * Type: make packed struct support intInfo * fix f80 alignment for i386-windows-msvc
2022-08-18stage2: agree with LLVM that `@alignOf(u128)` is 8Andrew Kelley
on x86_64 and similar targets.
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