aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
AgeCommit message (Collapse)Author
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-04-22stage1: Prevent the creation of illegal pointer typesLemonBoy
Changing the pointer length from Unknown to Single/C now resets the sentinel value too. Closes #5134
2020-04-22stage1: Another hack for the C ABI compatibilityLemonBoy
Applying the wrong ABI is slightly better than using the Zig ABI, the whole thing is so wrong it should be burned to the ground.
2020-04-20stage1: Handle errors when generating block IRLemonBoy
Closes #5005
2020-04-17add error for non-exter variadic functionsVexu
2020-04-17stage1: Fix several bugs in constant generationLemonBoy
The codegen would sometimes change the LLVM type for some constants to an unnamed structure in order to accomodate extra padding. This is fine as long as the alignment of each field is still respected and it was not the case for structure types, leading to ill-formed constants being generated. Optional types suffer from this to a lower extent as their layout is quite lucky, the only missing piece was the tail padding. Closes #4530 Closes #4594 Closes #4295 Closes my will to live
2020-04-07stage1: Respect the specified name for extern varLemonBoy
Extend the logic used for function definitions to variables. Closes #4947
2020-04-05type_has_one_possible_value takes comptime struct fields into accountAndrew Kelley
Before, type_has_one_possible_value would return false for the value `.{1}`. But actually, that type is a tuple with a single comptime field. Such a type, in fact, has one possible value. This plus the corresponding adjustment to get_the_one_possible_value solves #3878.
2020-04-02Fix multiplication overflow in `hash_const_val`Timon Kruiper
In some cases the compiler was actually emitting an 64 bit signed multiplication, instead of a 32 bit unsigned one.
2020-04-01stage1: make C++ switch fallthrough an errorMichael Dusan
Make fallthrough an error when compiler supports it. This requires a new macro that is defined with such compilers to be used as a statement, at all fallthrough sites: switch (...) { case 0: ... ZIG_FALLTHROUGH; case 1: ... break; default: ... break; } If we ever move to C++17 as minimal requirement, then the macro can be replaced with `[[fallthrough]];` at statement sites.
2020-04-01Make sure that ZigTypeVector and ZigTypeArray have the same memory layoutTimon Kruiper
Throughout the stage1 code it is assumed that these have the same layout, but that was not the case. This caused an issue on 32-bit hardware.
2020-03-26ability to compile c++ hello world with `zig c++`Andrew Kelley
closes #4786
2020-03-190-bit array type does not resolve child typeAndrew Kelley
2020-03-19`@ptrCast` supports casting a slice to pointerAndrew Kelley
2020-03-19fixes in semantic analysis needed to support this featureAndrew Kelley
2020-03-19slicing with comptime start and end results in arrayAndrew Kelley
implements #863
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