aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
AgeCommit message (Collapse)Author
2024-01-19do not enforce function parameters to be marked comptime if only called at ↵Meghan Denny
comptime
2024-01-19return optional state to `zirPtrCastNoDest`David Rubin
2024-01-18Merge pull request #18599 from dweiller/err-union-switch-err-traceAndrew Kelley
astgen: fix error return trace on error union switch
2024-01-18add type check to `zirSwitchBlockErrUnion`David Rubin
2024-01-18astgen: fix error return trace on error union switchdweiller
2024-01-16sema: fix safe integer arithmetic operations on undefined valuesTechatrix
Previously `@as(i64, undefined) +% 1` would produce `@as(@TypeOf(undefined), undefined)` which now gives `@as(i64, undefined)`. Previously `@as(i64, undefined) +| 1` would hit an assertion which now gives `@as(i64, undefined)`.
2024-01-15Merge pull request #18569 from dweiller/17944-followupAndrew Kelley
17944 followup
2024-01-15sema: fix OOM bug when constructing error messagesdweiller
2024-01-15Sema: fix `@extern` declsJacob Young
Closes #18550
2024-01-14Sema: fix compilation errorsAndrew Kelley
Commit 8afafa717f5c036595a3a781c63b6be7b478c025 passed CI checks against an older codebase and accumulated silent conflicts.
2024-01-14sema: allow slicing *T with comptime known [0..1]dweiller
2024-01-13Revert "Merge pull request #18410 from dweiller/by-length-slice-bug"Andrew Kelley
This reverts commit d9d840a33ac8abb0e616de862f592821a7f4a35e, reversing changes made to a04d4330945565b8d6f298ace993f6954c42d0f3. This is not an adequate implementation of the missing safety check, as evidenced by the changes to std.json that are reverted in this commit. Reopens #18382 Closes #18510
2024-01-12sema: forbid asm output to const localsMeghan Denny
2024-01-09sema: inherit block want_safety for err switch uniondweiller
2024-01-09astgen/sema: fix source locations for switch_block_err_uniondweiller
2024-01-09astgen/sema: use switch_block_err_union for if-else-switchdweiller
2024-01-09fix x86_64 crashes for switch_block_err_uniondweiller
This change only emits the unwrap_errunion_err instruction if the error capture is actually used in a branch.
2024-01-09sema: fix err union switch with inferred empty error setsdweiller
2024-01-09sema: allow maybeErrorUnwrap to handle err_union_codedweiller
2024-01-09sema: implement runtime switch_block_err_uniondweiller
2024-01-09sema: extract runtime switch AIR generation to functiondweiller
2024-01-09sema: implement switch_block_err_union on comptime operandsdweiller
2024-01-09sema: refactor error set switch logicdweiller
2024-01-09zir: add switch_block_err_uniondweiller
2024-01-09zir: remove unused zir as instructiondweiller
2024-01-08add type safety to ZIR for null terminated stringsAli Chraghi
2024-01-07Make `@typeInfo` return null-terminated stringsCarl Åstholm
Changes the types of `std.builtin.Type` `name` fields from `[]const u8` to `[:0]const u8`, which should make them easier to pass to C APIs expecting null-terminated strings. This will break code that reifies types using `[]const u8` strings, such as code that uses `std.mem.tokenize()` to construct types from strings at comptime. Luckily, the fix is simple: simply concatenate the `[]const u8` string with an empty string literal (`name ++ ""`) to explicitly coerce it to `[:0]const u8`. Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
2024-01-04sema: Prevent reifying non-empty union with empty tag typeCarl Åstholm
2024-01-04Sema: fix crash compiling `@shlExact`amp-59
Updated `zirShl`, to compute `shl_exact` with `comptime_int` LHS operand like `shl`, and added test case for `@shlExact` with `comptime_int` LHS operand.
2024-01-03Merge pull request #18431 from jacobly0/cbe-externAndrew Kelley
cbe: fix non-msvc externs and exports
2024-01-03add missing resolveStructFieldInitsxdBronch
2024-01-03cbe: fix non-msvc externs and exportsJacob Young
Closes #17817
2024-01-03Sema: Added logic to avoid unchecked operations calling `preparePanicId` ↵amp-59
(#18416) Fixes #18415
2024-01-02Merge pull request #18160 from ziglang/std-build-moduleAndrew Kelley
Move many settings from being per-Compilation to being per-Module
2024-01-02Merge pull request #18410 from dweiller/by-length-slice-bugVeikka Tuominen
sema: add compile error for OOB by-length slice of array
2024-01-01Compilation: make create() take an arena allocatorAndrew Kelley
Instead of making its own inside create. 10 out of 10 calls to create() had already an arena in scope, so this commit means that 10 instances of Compilation now reuse an existing arena with the same lifetime rather than creating a redundant one. In other words, this very slightly optimizes initialization of the frontend in terms of memory allocation.
2024-01-01resolve error tracing logic at module creation timeAndrew Kelley
rather than checking multiple conditions in Sema
2024-01-01fix compilation errors when enabling llvmAndrew Kelley
2024-01-01fix remaining compile errors except oneAndrew Kelley
2024-01-01update bin_file.options references in SemaAndrew Kelley
mainly pertaining to error return tracing
2024-01-01compiler: miscellaneous branch progressAndrew Kelley
implement builtin.zig file population for all modules rather than assuming there is only one global builtin.zig module. move some fields from link.File to Compilation move some fields from Module to Compilation compute debug_format in global Compilation config resolution wire up C compilation to the concept of owner modules make whole cache mode call link.File.createEmpty() instead of link.File.open()
2024-01-01linkers: update references to "options" fieldAndrew Kelley
2024-01-01WIP: move many global settings to become per-ModuleAndrew Kelley
Much of the logic from Compilation.create() is extracted into Compilation.Config.resolve() which accepts many optional settings and produces concrete settings. This separate step is needed by API users of Compilation so that they can pass the resolved global settings to the Module creation function, which itself needs to resolve per-Module settings. Since the target and other things are no longer global settings, I did not want them stored in link.File (in the `options` field). That options field was already a kludge; those options should be resolved into concrete settings. This commit also starts to work on that, deleting link.Options, moving the fields into Compilation and ObjectFormat-specific structs instead. Some fields were ephemeral and should not have been stored at all, such as symbol_size_hint. The link.File object of Compilation is now a `?*link.File` and `null` when -fno-emit-bin is passed. It is now arena-allocated along with Compilation itself, avoiding some messy cleanup code that was there before. On the command line, it is now possible to configure the standard library itself by using `--mod std` just like any other module. This meant that the CLI needed to create the standard library module rather than having Compilation create it. There are a lot of changes in this commit and it's still not done. I didn't realize how quickly this changeset was going to balloon out of control, and there are still many lines that need to be changed before it even compiles successfully. * introduce std.Build.Cache.HashHelper.oneShot * add error_tracing to std.Build.Module * extract build.zig file generation into src/Builtin.zig * each CSourceFile and RcSourceFile now has a Module owner, which determines some of the C compiler flags.
2024-01-01move is_libcpp_lib_name and is_libc_lib_name to std.TargetAndrew Kelley
2024-01-01Compilation: cleanup hashmap usageJacob Young
2023-12-31sema: add compile error for OOB by-length slice of arraydweiller
2023-12-29Sema: Initialise `want_safety` for switch prong child blockamp-59
2023-12-28Sema: fix merging stores instructions from a comptime struct value with ↵cfillion
`-fstrip` The first instruction in the block was never checked resulting in `struct_is_comptime` being incorrectly cleared if there are no instructions before the first field of the comptime struct. Fixes #17119
2023-12-23Sema: ensure `slice_ptr` produces the correct typeJacob Young
Closes #18345
2023-12-13Compilation: remove parent_compilation_link_libcAndrew Kelley
This option is not needed since the link_libc flag can be set directly when creating compiler_rt. This fixes a problem where an immutable flag was being mutated in Sema.