13090 Commits

Author SHA1 Message Date
Andrew Kelley
7aa85691b0
Merge pull request #17504 from ziglang/fix-var-args-coercion
Sema: fix crash when coercion dest is var args
2023-10-13 08:16:55 -07:00
Andrew Kelley
027aabf497 drop for loop syntax upgrade mechanisms 2023-10-13 03:43:54 -07:00
Andrew Kelley
69dc1a6bb2 llvm: fix incorrect file paths in debug info
The previous code incorrectly added `sub_path` twice.

Also for the compilation unit, it was passing empty string to realpath,
resulting in the error handling codepath being used.

closes #17482
2023-10-13 03:07:50 -07:00
Andrew Kelley
b6762c2473 Sema: fix crash when ref coercion dest is var args
When analyzing the `validate_ref_ty` ZIR instruction, an assertion would
trip if the result type was a var args function argument. The fix is the
same as e6b73be870a39f4da7a08a40da23e38b5e9613da - inline the logic of
`resolveType` and handle the case of var args.

Closes #17494
2023-10-13 00:31:22 -07:00
Andrew Kelley
e6b73be870 Sema: fix crash when coercion dest is var args
When analyzing the `as` ZIR instruction, an assertion would trip if the
result type was a var args function argument. The fix is simple: inline
a little bit of the `resolveType` logic into `analyzeAs` to make it
detect this situation - which it was already attempting to do.

Closes #16197
2023-10-12 22:03:39 -07:00
Ryan Liptak
2769215b90 Add zig rc subcommand, a drop-in replacement for rc.exe
Uses resinator under-the-hood (see https://github.com/ziglang/zig/pull/17069)

Closes #9564
2023-10-12 16:19:34 -07:00
Andrew Kelley
b9f75a39d3 Package.Manifest: fix error message for paths
closes #17491
2023-10-12 10:47:22 -07:00
Andrew Kelley
1d1e5a8617 Package.Fetch: fix empty path and "." not including all
Related to #17491
2023-10-12 10:47:22 -07:00
Krzysztof Wolicki
8c6b0271cc Package.Fetch: wrap operations involving tmp_directory in a block
This makes tmp_directory close before calling renameTmpIntoCache which fixes occurences of those AccessDenied errors that aren't synonymous with PathAlreadyExists on Windows
2023-10-11 20:28:07 -07:00
Andrew Kelley
5722261e64
Merge pull request #17465
Compilation: default to self-hosted backends when not using libllvm
2023-10-11 00:53:07 -07:00
Ryan Liptak
42998e637b Package: Fix path separator not being escaped between root_dir and sub_path
Fixes a package fetching regression on Windows. Closes #17477
2023-10-10 23:02:03 -07:00
mlugg
1033d71017 Sema,type: unify type query functions
The following pairs of functions have been combined using the "advanced"
pattern used for other type queries:

* `Sema.fnHasRuntimeBits`, `Type.isFnOrHasRuntimeBits`
* `Sema.typeRequiresComptime`, `Type.comptimeOnly`
2023-10-10 21:40:23 -07:00
Andrew Kelley
da7e4fb31a revert compiler_rt: no need to put it in a static library
This mostly reverts 6e0904504155d3cba80955c108116170fd739aec however it
leaves intact the linker supporting both obj and lib files, and the
frontend choosing which one to create.
2023-10-10 11:23:39 -07:00
Andrew Kelley
8679c7a607 Compilation: default to self-hosted backend when not using libllvm
When not using libllvm, it means the compiler is not capable of
producing an object file or executable, making the self-hosted backends
be a better default.
2023-10-10 11:17:29 -07:00
Andrew Kelley
6e09045041 compiler_rt: no need to put it in a static library
It's simpler to link against compiler_rt.o directly.
2023-10-10 11:17:29 -07:00
Andrew Kelley
2ca7cc46c4 Package.Fetch: fix inclusions not working for directories
Oops, the loop was checking the wrong variable! Added a unit test.
2023-10-10 02:29:29 -07:00
Andrew Kelley
aaf46187ab
Merge pull request #17391 from xxxbxxx/load-i4
codegen/llvm: truncate padding bits when loading a non-byte-sized value
2023-10-09 22:06:49 -07:00
Andrew Kelley
fa08e49f83 Package.Fetch: allow relative paths outside project root
Only for packages that come from the main package. Fetched packages
still cannot depend on paths outside their package root.
2023-10-09 22:01:18 -07:00
Veikka Tuominen
b2c36b14de Sema: fix dbg_inline instructions not being emitted
This broke with #16604 but went unnoticed due to lack of tests.
Closes #17444
2023-10-09 21:00:31 -07:00
Jacob Young
9e341a6da3
Merge pull request #17447 from jacobly0/x86_64
x86_64: fix codegen errors when compiling compiler_rt
2023-10-09 16:18:50 -04:00
Jacob Young
922b5b5453 x86_64: implement 128-bit integer multiply and divide 2023-10-09 05:23:23 -04:00
Jacob Young
d559c61902 x86_64: implement @min and @max for 128-bit integers 2023-10-09 03:11:41 -04:00
Jacob Young
21948d7540 x86_64: implement @abs of 128-bit integers 2023-10-09 03:11:41 -04:00
Jacob Young
a96c08c1d1 x86_64: implement struct field value for register pairs 2023-10-09 03:11:40 -04:00
Jacob Young
f28b1657aa x86_64: implement 128-bit integer shifts in registers 2023-10-09 03:09:01 -04:00
Andrew Kelley
95907cb795 restore progress reporting for package fetching 2023-10-08 21:14:30 -07:00
Andrew Kelley
5eb5d523b5 give modules friendly names for error reporting 2023-10-08 20:58:04 -07:00
Andrew Kelley
cd4397783f Package.Fetch: improved deletion algorithm
Instead of every file deletion being followed by a recursive attempt to
remove the parent directory, while walking the directory, every
directory that will have nonzero files deleted from it is tracked in an
array hash map.

After all the threads have finished deleting and hashing, the parent
thread sorts the "suspicious" directories by length, descending,
ensuring that children appear before parents, and then iterates over the
array hash map, attempting a rmdir operation on each. Any rmdir that
succeeds appends the parent directory to the map so that it will be
removed if empty.
2023-10-08 20:03:40 -07:00
Andrew Kelley
4a2cf38844 Package.Fetch: apply inclusion rules from build.zig.zon 2023-10-08 19:29:17 -07:00
Andrew Kelley
1b372f1872 fix using the wrong allocator for modules 2023-10-08 18:23:38 -07:00
Andrew Kelley
5e7c44a321 Package.Fetch: tighten up check for path outside root 2023-10-08 17:42:49 -07:00
Andrew Kelley
6d84caf727 move some package management related source files around 2023-10-08 17:29:55 -07:00
Andrew Kelley
7bae6d9064 fix dependencies.zig generation with no dependencies 2023-10-08 17:26:02 -07:00
Andrew Kelley
8f20ce74f4 zig fetch: require 'paths' field in the manifest 2023-10-08 17:21:18 -07:00
Andrew Kelley
f0cc6f17a0 Package.Fetch: fix not making directory paths for symlinks 2023-10-08 17:21:08 -07:00
Andrew Kelley
f48ec4b8ee use long-lived arena for @cImport-generated Module 2023-10-08 16:54:31 -07:00
Andrew Kelley
1ad33f53fe give build.zig modules access to their dependencies' build.zig modules 2023-10-08 16:54:31 -07:00
Andrew Kelley
ce052d89a8 Manifest: fix not initializing token locations 2023-10-08 16:54:31 -07:00
Andrew Kelley
47a413361d Package.Fetch: fix handling of relative paths 2023-10-08 16:54:31 -07:00
Andrew Kelley
1fd95fc005 Package.Fetch: resolve instead of join relative paths
This prevents bogus "error: file exists in multiple modules" errors due
to file paths looking like:
```
note: root of module foo/freetype/
note: root of module foo/fontconfig/../freetype/
```

It also enables checking for dependency paths outside the root package.
2023-10-08 16:54:31 -07:00
Andrew Kelley
29156de120 CLI: fix only_core_functionality logic 2023-10-08 16:54:31 -07:00
Andrew Kelley
a605bd9887 zig build: add --fetch argument
closes #14280
2023-10-08 16:54:31 -07:00
Andrew Kelley
b2fefc8473 dependencies.zig: omit deps without hashes 2023-10-08 16:54:31 -07:00
Andrew Kelley
b7fc53c92a dependencies.zig: omit modules without build.zig as deps 2023-10-08 16:54:31 -07:00
Andrew Kelley
7b25d050e6 std.tar: fix creation of symlinks with omit_empty_directories 2023-10-08 16:54:31 -07:00
Andrew Kelley
e5c2a7dbca finish hooking up new dependency tree logic
* add Module instances for each package's build.zig and attach it to the
  dependencies.zig module with the hash digest hex string as the name.
* fix incorrectly skipping the wrong packages for creating
  dependencies.zig
* a couple more renaming of "package" to "module"
2023-10-08 16:54:31 -07:00
Andrew Kelley
35d81c99c0 more fixes related to previous commits Package/Module API 2023-10-08 16:54:31 -07:00
Andrew Kelley
a232f7e8ec finish implementing the auto-generated dependencies.zig module 2023-10-08 16:54:31 -07:00
Andrew Kelley
e86b7fcca3 fix detection of build.zig file inside packages 2023-10-08 16:54:31 -07:00
Andrew Kelley
4eb7b61daa package fetching: generate dependencies.zig file
Only problem is that it looks like `has_build_zig` is being false when
it should be true.

After that is fixed then main.zig needs to create the `@dependencies`
module from the generated source code.
2023-10-08 16:54:31 -07:00