aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
AgeCommit message (Collapse)Author
2019-05-06stage1: add @hasField() built-inShawn Landden
This was quite straight-forward Closes: #1439
2019-04-28Fix generation of container initializersLemonBoy
The code creates temporary ConstExprValue with global_refs set to nullptr and that's carried over to the final value. Doing so prevents the deduplication mechanism to work correctly, causing all sorts of runtime crashes. Fixes #1636 Fixes #1608 (Even though it was already fixed by #1991)
2019-04-25translate-c: put -x c back in there, it's necessaryAndrew Kelley
2019-04-25translate-c: unify API for self-hosted and C++ translate-cAndrew Kelley
See #1964
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-24`@sizeOf` returns 0 for comptime typesAndrew Kelley
This defines `@sizeOf` to be the runtime size of a type, which means that it is zero for types such as comptime_int, type, and (enum literal). See #2209
2019-04-24Merge pull request #2296 from LemonBoy/translate-c-stuffAndrew Kelley
Handle implicit casts in translate-c
2019-04-24fixed #2356Jimmi HC
const_ptr_pointee_unchecked did not take into account that if the pointer is zero sized, then const_val->data.x_ptr.special would be ConstPtrSpecialInvalid. This commit fixes this by also checking that the child type of the pointer only have one possible value and just returns that value.
2019-04-22Add some zig_panic for 80-bit float codepathsLemonBoy
2019-04-15link: exemption for wasm instead of wasiShritesh Bhattarai
2019-04-14Merge pull request #2268 from shritesh/wasiAndrew Kelley
wasm: preliminary WASI OS support
2019-04-13wasi: better extern wasi logicShritesh Bhattarai
2019-04-13support extern "wasi" functionsShritesh Bhattarai
2019-04-13better handle quota of setEvalBranchQuotaAndrew Kelley
Now that c58b80203443dcbf8b737ebdaa1f17fb20c77711 has removed the "top of the comptime stack" requirement, the branch quota can be modified somewhere other than the top of the comptime stack. This means that the quota of a parent IrExecutable has to be modifiable by an instruction in the child. Closes #2261
2019-04-07src/ir.cpp: don't call-out to analyze_type_expr;kristopher tate
replaces `analyze_type_expr` with `ir_analyze_type_expr`
2019-04-06removed todo comment and added testJimmi Holst Christensen
2019-04-06fixed 1726Jimmi Holst Christensen
2019-04-06ir: avoid dependency on isnanAndrew Kelley
there's a simple way to check for nan that does not need this header. hryx on IRC reported that Linux Mint based on ubuntu 16.04, kernel 4.15.0, x86_64 did not have the isnan function.
2019-04-05fix dereferencing a zero bit typeAndrew Kelley
Before only u0 was special cased in handling a dereference; now all zero bit types are handled the same way. Dereferencing a pointer to a zero bit type always gives a comptime-known result. This previously had been failing on master branch but went unnoticed because until 846f72b57cb5 the CI server was mistakenly not actually running the single-threaded tests with --single-threaded. This fixes the standard library tests with --single-threaded --release-fast.
2019-04-04fix NaN comparing equal to itselfAndrew Kelley
This was broken both in comptime code and in runtime code. closes #1174
2019-04-02more regression fixesAndrew Kelley
2019-04-02remove the lazy value stuffAndrew Kelley
let's try to keep this branch to solving one problem at a time
2019-04-02introduce lazy valuesAndrew Kelley
but I think it's a bad idea, so I'm going to back out the change
2019-04-02decouple llvm types from zig typesAndrew Kelley
Not tested yet, but it builds. This closes #761, and lays the groundwork for fixing the remaining false positive "foo depends on itself" bugs, such as #624. It also lays the groundwork for implementing ability to specify alignment of fields (#1512).
2019-03-31added error for implicit cast from *const T to *[1]T. credit: @kristateemekoi
2019-03-31fix anon enum literal used with switch on union(enum)Andrew Kelley
closes #2141 closes #2142
2019-03-28stage1: better error message when comparing against nullShawn Landden
Closes: #2104
2019-03-25implement allowzero pointer attributeAndrew Kelley
closes #1953 only needed for freestanding targets. also adds safety for `@intToPtr` when the address is zero.
2019-03-24add compile error test for invalid enum literal implicit castAndrew Kelley
See #683
2019-03-24implement peer type resolution for enum literalsAndrew Kelley
See #683
2019-03-24make switch expressions allow enum literal typesAndrew Kelley
See #683
2019-03-24implement implicit cast from enum literal to enumAndrew Kelley
See #683
2019-03-24introduce the enum literal typeAndrew Kelley
see #683
2019-03-23add compile error for ignoring errorAndrew Kelley
closes #772
2019-03-23add peer type resolution for `*const T` and `?*T`Andrew Kelley
closes #1298
2019-03-20add docs for assembly and fix global assembly parsingAndrew Kelley
Previously, global assembly was parsed expecting it to have the template syntax. However global assembly has no inputs, outputs, or clobbers, and thus does not have template syntax. This is now fixed. This commit also adds a compile error for using volatile on global assembly, since it is meaningless. closes #1515
2019-03-15fix while continue block not checking for ignored expressionAndrew Kelley
closes #957
2019-03-15breaking changes to std.mem.Allocator interface APIAndrew Kelley
Before, allocator implementations had to provide `allocFn`, `reallocFn`, and `freeFn`. Now, they must provide only `reallocFn` and `shrinkFn`. Reallocating from a zero length slice is allocation, and shrinking to a zero length slice is freeing. When the new memory size is less than or equal to the previous allocation size, `reallocFn` now has the option to return `error.OutOfMemory` to indicate that the allocator would not be able to take advantage of the new size. For more details see #1306. This commit closes #1306. This commit paves the way to solving #2009. This commit also introduces a memory leak to all coroutines. There is an issue where a coroutine calls the function and it frees its own stack frame, but then the return value of `shrinkFn` is a slice, which is implemented as an sret struct. Writing to the return pointer causes invalid memory write. We could work around it by having a global helper function which has a void return type and calling that instead. But instead this hack will suffice until I rework coroutines to be non-allocating. Basically coroutines are not supported right now until they are reworked as in #1194.
2019-03-14breaking: fix @typeInfo handling of global error set typeAndrew Kelley
`builtin.TypeInfo.ErrorSet` is now `?[]Error` instead of `struct{errors:[]Error}`. closes #1936
2019-03-13breaking: remove --static; add -dynamicAndrew Kelley
`--static` is no longer an option. Instead, Zig makes things as static as possible by default. `-dynamic` can be used to choose a dynamic library rather than a static one. `--enable-pic` is a new option. Usually it will be enabled automatically, but in the case of build-exe with no dynamic libraries on Linux or freestanding, Zig chooses off by default. closes #1703 closes #1828
2019-03-13Fix generation of comptime slicesLemonBoy
By erasing the global_refs field we'd trip any codepath using const_values_equal_ptr to figure if two slices were different.
2019-03-11Merge pull request #2049 from ziglang/problematic-mtime-detectionAndrew Kelley
stage1 caching system: detect problematic mtimes
2019-03-11ir: fix handling of OnePossibleValueInvalidAndrew Kelley
this is the poison value which means a compile error has already been reported
2019-03-11check for type_has_one_possible_value and added correct caching to TypeInfoJimmi HC
2019-03-11fixed enum to union codeJimmi Holst Christensen
2019-03-11use cached const_void_valJimmi Holst Christensen
2019-03-11removed wild tabJimmi Holst Christensen
2019-03-11fixed #1600Jimmi Holst Christensen
2019-03-11stage1 caching system: detect problematic mtimesAndrew Kelley
closes #2045
2019-03-08breaking changes to zig build API and improved cachingAndrew Kelley
* in Zig build scripts, getOutputPath() is no longer a valid function to call, unless setOutputDir() was used, or within a custom make() function. Instead there is more convenient API to use which takes advantage of the caching system. Search this commit diff for `exe.run()` for an example. * Zig build by default enables caching. All build artifacts will go into zig-cache. If you want to access build artifacts in a convenient location, it is recommended to add an `install` step. Otherwise you can use the `run()` API mentioned above to execute programs directly from their location in the cache. Closes #330. `addSystemCommand` is available for programs not built with Zig build. * Please note that Zig does no cache evicting yet. You may have to manually delete zig-cache directories periodically to keep disk usage down. It's planned for this to be a simple Least Recently Used eviction system eventually. * `--output`, `--output-lib`, and `--output-h` are removed. Instead, use `--output-dir` which defaults to the current working directory. Or take advantage of `--cache on`, which will print the main output path to stdout, and the other artifacts will be in the same directory with predictable file names. `--disable-gen-h` is available when one wants to prevent .h file generation. * `@cImport` is always independently cached now. Closes #2015. It always writes the generated Zig code to disk which makes debug info and compile errors better. No more "TODO: remember C source location to display here" * Fix .d file parsing. (Fixes the MacOS CI failure) * Zig no longer creates "temporary files" other than inside a zig-cache directory. This breaks the CLI API that Godbolt uses. The suggested new invocation can be found in this commit diff, in the changes to `test/cli.zig`.