aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
AgeCommit message (Collapse)Author
2020-03-19ir: More changes to sentinel-terminated const arraysLemonBoy
* Don't add an extra slot for the sentinel. Most of the code keeps using the constant value from the type descriptor, let's harmonize all the code dealing with sentinels. * Properly write out sentinel values when reinterpreting pointers at comptime. * Allow the reading of the 0th element in a `[0:S]T` type.
2020-03-18array sentinel does not count towards type_has_one_possible_valueAndrew Kelley
2020-03-18ir: Correct ABI size calculation for arraysLemonBoy
Zero-length array with a sentinel may not have zero size. Closes #4749
2020-03-09Merge pull request #4590 from xackus/fix-4587Andrew Kelley
fix failed assert on generic fn opaque return type
2020-03-09ir: Fix codegen of ?*T types where T is zero-sizedLemonBoy
* Fix codegen for optional types that decay to a pointer, the type behaves as a boolean * Fix comptime evaluation of zero-sized arrays, always initialize the internal array elements Closes #4673
2020-03-09better error messages and more testsxackus
2020-03-09implement noasync scopesVexu
2020-03-08ir: Prevent crash in compiler errorLemonBoy
Anonymous containers have no struct_field->type AstNode set, let's always use the field node itself to make the error messages consistent. Closes #4691
2020-03-08fix failed assert on generic fn opaque return typexackus
2020-03-06stage1: make get_optional_type more robustAndrew Kelley
Now it will emit a compile error rather than crashing when the child type has not been resolved properly. Introduces `get_optional_type2` which should be used generally inside ir.cpp. Fix some std lib compile errors noticed by the provided test case. Thanks @LemonBoy for the test case. Closes #4377. Fixes #4374.
2020-03-05stage1: fix regressionMichael Dusan
- regression was introduced by 371c21aa70fc61ef703e34079ce6de6c52ec91df
2020-03-05stage1: housekeepingMichael Dusan
- use consistent allocator in `realloc_const_vals_ptrs()` - unexport `create_fn_raw()`
2020-03-04get_codegen_ptr_type returns possible errorAndrew Kelley
And fix most of the fallout. This also makes optional pointers not require resolving zero bits, because the comptime value struct layout no longer depends on whether the type has zero bits. Thanks to @LemonBoy for the behavior test case Closes #4357 Closes #4359
2020-02-29Merge pull request #4550 from ziglang/os-version-rangesAndrew Kelley
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
2020-02-29fix crash when building docgenAndrew Kelley
2020-02-28fix typo from other commitAndrew Kelley
d2535c003c6188fcc362028e01ef9f7fb3356727
2020-02-28fix crash with multiple comptime fn calls and...Andrew Kelley
...default initialized array to undefined closes #4578
2020-02-28fix compiler crash when comptime parsing targetsAndrew Kelley
2020-02-28improve debug info for optionalsAndrew Kelley
2020-02-28restructuring std.Target for OS version ranges, pass 1Andrew Kelley
2020-02-26ir: Allow empty inferred error setsLemonBoy
Closes #4564
2020-02-26ir: Fix regression with self-referencing containersLemonBoy
2020-02-25ir: Fix sizeOf comparison with ptr to zstLemonBoy
Closes #4536
2020-02-18Makes the declaration slice resolve lazely when using `@typeInfo`Timon Kruiper
This way all the declarations in a container won't be resolved untill the user actually uses the decls slice in the builtin TypeInfo union.
2020-02-16Implement noasync awaitsAndrew Kelley
Note that there is not yet runtime safety for this. See #3157
2020-02-12Fix rendering of empty arraysLemonBoy
2020-02-10stage1: memory/report overhaulMichael Dusan
- split util_base.hpp from util.hpp - new namespaces: `mem` and `heap` - new `mem::Allocator` interface - new `heap::CAllocator` impl with global `heap::c_allocator` - new `heap::ArenaAllocator` impl - new `mem::TypeInfo` extracts names without RTTI - name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1 - new `mem::List` takes explicit `Allocator&` parameter - new `mem::HashMap` takes explicit `Allocator&` parameter - add Codegen.pass1_arena and use for all `ZigValue` allocs - deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10Merge pull request #4404 from ziglang/async-stdAndrew Kelley
a big step towards std lib integration with async I/O
2020-02-09fix defer interfering with return value spillAndrew Kelley
2020-02-08solve previous commit a better wayAndrew Kelley
2020-02-08Revert "properly spill optional payload capture value"Andrew Kelley
This reverts commit 80ba21b83cd13849c1d1d9cdebfa070b03f334d3.
2020-02-08properly spill optional payload capture valueAndrew Kelley
2020-02-07Add wWinMain and wWinMainCRTStartup to fix #4376Jared Miller
2020-02-07fix invalid behavior tests from prev commitAndrew Kelley
and fix "no-op casts" from incorrectly spilling
2020-02-06more std lib async I/O integrationAndrew Kelley
* `zig test` gainst `--test-evented-io` parameter and gains the ability to seamlessly run async tests. * `std.ChildProcess` opens its child process pipe with O_NONBLOCK when using evented I/O * `std.io.getStdErr()` gives a File that is blocking even in evented I/O mode. * Delete `std.event.fs`. The functionality is now merged into `std.fs` and async file system access (using a dedicated thread) is automatically handled. * `std.fs.File` can be configured to specify whether its handle is expected to block, and whether that is OK to block even when in async I/O mode. This makes async I/O work correctly for e.g. the file system as well as network. * `std.fs.File` has some deprecated functions removed. * Missing readv,writev,pread,pwrite,preadv,pwritev functions are added to `std.os` and `std.fs.File`. They are all integrated with async I/O. * `std.fs.Watch` is still bit rotted and needs to be audited in light of the new async/await syntax. * `std.io.OutStream` integrates with async I/O * linked list nodes in the std lib have default `null` values for `prev` and `next`. * Windows async I/O integration is enabled for reading/writing file handles. * Added `std.os.mode_t`. Integer sizes need to be audited. * Fixed #4403 which was causing compiler to crash. This is working towards: ./zig test ../test/stage1/behavior.zig --test-evented-io Which does not successfully build yet. I'd like to enable behavioral tests and std lib tests with --test-evented-io in the test matrix in the future, to prevent regressions.
2020-02-02Don't generate any type info for void return typesLemonBoy
Closely matches what the LLVM debug emitter expects, the generated DWARF infos are now standard-compliant.
2020-01-30fix llvm assertion with debug info for vectorsAndrew Kelley
2020-01-28fix compile error regression with struct containing itselfAndrew Kelley
2020-01-28fix 0-bit child type coerced to optional return ptr result locationAndrew Kelley
by un-special-casing 0 bit types in result locations
2020-01-27fix nested bitcast passed as tuple elementAndrew Kelley
2020-01-27Merge branch 'master' into ir-clean-up-varsAndrew Kelley
2020-01-25split IrInstruction into IrInst, IrInstSrc, IrInstGenAndrew Kelley
This makes it so that less memory is used for IR instructions, as well as catching bugs when one expected one kind of instruction and received the other.
2020-01-19Fix wrong error code being returned in enum analisysLemonBoy
Fixes the assertion failure seen in #4233
2020-01-18Prevent crash with empty non-exhaustive enumLemonBoy
2020-01-16fix failing array test by improving copy_const_valAndrew Kelley
2020-01-16fix regressions double implicit casting return ptrAndrew Kelley
2020-01-16fix implicit cast regressionAndrew Kelley
2020-01-16fix regression in global const alignmentAndrew Kelley
2020-01-16zig ir.cpp details: remove the mem_slot mechanismAndrew Kelley
Previously, there was hacky code to deal with result locations and how they work with regards to comptime values and runtime values. In addition, there was a hacky "mem_slot" mechanism that managed the memory for local variables, and acted differently depending on comptime vs runtime situations. All that is deleted in this commit, and as a result, result locations code has one less complication. Importantly, this means that a comptime result location is now passed to a function when it is evaluated at comptime. This test causes many regressions, and some of the behavior tests are disabled (commented out) in this commit. Future commits will re-enable the tests before merging the branch.
2020-01-16correct field countVexu