aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
AgeCommit message (Collapse)Author
2019-04-26clean up test outputAndrew Kelley
After 4df2f3d74f test names have the word "test" in them so the redundant word is removed from test runner. Also move the prefix/suffix to where it logically belongs in the fully qualified symbol name.
2019-04-26Change symbol name of tests in codegenrylmovuk
Tests now have the symbol name of the format `test "<name>"` in order to be more easily distinguished from functions with similar names. See issue #2267.
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-24remove Shebang (#!) supportShawn Landden
Closes: #2165
2019-04-16stage1: const_values_equal support tagged unionMichael Dusan
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-02emit better debug info for enumsAndrew Kelley
fixes llvm assertion when building for windows
2019-04-02fix LLVM assertion failuresAndrew Kelley
2019-04-02fix setting union body twiceAndrew Kelley
2019-04-02avoid tripping assertion for setting struct body twiceAndrew Kelley
2019-04-02passing all testsAndrew Kelley
2019-04-02put the alignment hack in for unions too. fixes std testsAndrew Kelley
2019-04-02behavior tests passing againAndrew Kelley
2019-04-02more regression fixes. empty test passes againAndrew Kelley
2019-04-02regression fixes and fix packed struct abi sizeAndrew Kelley
2019-04-02more regression fixesAndrew Kelley
2019-04-02bug fixesAndrew Kelley
2019-04-02put the hack from master branch back inAndrew 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-25implement allowzero pointer attributeAndrew Kelley
closes #1953 only needed for freestanding targets. also adds safety for `@intToPtr` when the address is zero.
2019-03-24introduce the enum literal typeAndrew Kelley
see #683
2019-03-19c_abi: when compiling for x86_64, differenciate between system V and windows ABISahnvour
2019-03-16add compile error for wrong type with `use`Andrew Kelley
closes #1557
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-10fix inconsistent type information of optional C pointersAndrew Kelley
solves an assertion failure in LLVM
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`.
2019-03-03fix const initialization of optional C pointer to nullAndrew Kelley
2019-03-02fix @typeName on slicesAndrew Kelley
closes #2026
2019-03-02compile error for import outside package pathAndrew Kelley
closes #2024 there's a new cli option `--main-pkg-path` which you can use to choose a different root package directory besides the one inferred from the root source file and a corresponding build.zig API: foo.setMainPkgPath(path)
2019-03-01gen-h: use the bare type names for nowAndrew Kelley
2019-03-01@typeInfo for structs and opaque types is the bare nameAndrew Kelley
2019-03-01fix dependency loops, pub, tests, use decls, root sourceAndrew Kelley
* fix dependency loop detection - closes #679 - closes #1500 * fix `pub` * fix tests * fix use decls * main package file gets a special "" namespace path
2019-02-28fix "use" declsAndrew Kelley
2019-02-28struct types get fully qualified namesAndrew Kelley
and function symbol names become fully qualified
2019-02-28remove namespace type; files are empty structsAndrew Kelley
closes #1047
2019-02-26fix handling when there are multiple externs andAndrew Kelley
an export in the same object closes #529
2019-02-26breaking changes to the way targets work in zigAndrew Kelley
* CLI: `-target [name]` instead of `--target-*` args. This matches clang's API. * `builtin.Environ` renamed to `builtin.Abi` - likewise `builtin.environ` renamed to `builtin.abi` * stop hiding the concept of sub-arch. closes #1526 * `zig targets` only shows available targets. closes #438 * include all targets in readme, even those that don't print with `zig targets` but note they are Tier 4 * refactor target.cpp and make the naming conventions more consistent * introduce the concept of a "default C ABI" for a given OS/Arch combo. As a rule of thumb, if the system compiler is clang or gcc then the default C ABI is the gnu ABI.
2019-02-25fix infinite recursion in type_has_one_possible_valueAndrew Kelley
closes #2006
2019-02-23better libc detection (#1996)Andrew Kelley
* better libc detection This introduces a new command `zig libc` which prints the various paths of libc files. It outputs them to stdout in a simple text file format that it is capable of parsing. You can use `zig libc libc.txt` to validate a file. These arguments are gone: --libc-lib-dir [path] directory where libc crt1.o resides --libc-static-lib-dir [path] directory where libc crtbegin.o resides --msvc-lib-dir [path] (windows) directory where vcruntime.lib resides --kernel32-lib-dir [path] (windows) directory where kernel32.lib resides Instead we have this argument: --libc [file] Provide a file which specifies libc paths This is used to pass a libc text file (which can be generated with `zig libc`). So it is easier to manage multiple cross compilation environments. `--cache on` now works when linking against libc. `ZigTarget` now has a bool field `is_native` Better error messaging when you try to link against libc or use `@cImport` but the various paths cannot be found. It should also be faster. * save native_libc.txt in zig-cache This avoids having to detect libc at runtime on every invocation.
2019-02-21better handling of arrays in packed structsAndrew Kelley
* Separate LoadPtr IR instructions into pass1 and pass2 variants. * Define `type_size_bits` for extern structs to be the same as their `@sizeOf(T) * 8` and allow them in packed structs. * More helpful error messages when trying to use types in packed structs that are not allowed. * Support arrays in packed structs even when they are not byte-aligned. * Add compile error for using arrays in packed structs when the padding bits would be problematic. This is necessary since we do not have packed arrays. closes #677
2019-02-20packed structs support comptime bitcastingAndrew Kelley
* `type_size_store` is no longer a thing. loading and storing a pointer to a value may dereference up to `@sizeOf(T)` bytes, even for integers such as `u24`. * fix `types_have_same_zig_comptime_repr` to not think that the same `ZigTypeId` means the `ConstExprValue` neccesarily has the same representation. * implement `buf_write_value_bytes` and `buf_read_value_bytes` for `ContainerLayoutPacked` closes #1120
2019-02-19Prevent crash in tagged enums rendering (#1986)LemonBoy
* Prevent crash in tagged enums rendering * Add a test case
2019-02-18src/analyze.cpp: default to using `param_node` upon callconv error;kristopher tate
2019-02-18export _mh_execute_header with weak linkageAndrew Kelley
* also fix extern variables with initialiaztion values to generate runtime code * remove the workaround in example/shared_library/mathtest.zig * introduce the ability for global variables to have Weak and LinkOnce linkage * fix `@export` to work for non-functions. this code needs to be audited though. * fix comptime ptrcast not keeping bigger alignment * fix linker warnings when targeting darwin closes #1903
2019-02-17Add NetBSD supportMaya Rashish
Mostly picking the same paths as FreeBSD. We need a little special handling for crt files, as netbsd uses its own (and not GCC's) for those, with slightly different names.
2019-02-15removed hidden union tag in release modesemekoi
2019-02-15typecheck the panic functionAndrew Kelley
this adds the prototype of panic to @import("builtin") and then uses it to do an implicit cast of the panic function to this prototype, rather than redoing all the implicit cast logic. closes #1894 closes #1895
2019-02-15breaking: fix @sizeOf to be alloc size rather than store sizeAndrew Kelley
* Fixes breaches of the guarantee that `@sizeOf(T) >= @alignOf(T)` * Fixes std.mem.secureZero for integers where this guarantee previously was breached * Fixes std.mem.Allocator for integers where this guarantee previously was breached Closes #1851 Closes #1864