Veikka Tuominen
fe6249348f
Sema: ensure comptime reference to function points to original decl
...
This prevents sema from creating new decls for the functions and
passing them to the backends as non-function decls.
Closes #12501
2022-11-16 01:12:54 +02:00
Veikka Tuominen
2cfa7165e7
Sema: do not re-evaluate type of non-generic inline call parameters
...
Closes #13491
2022-11-16 01:12:27 +02:00
mparadinha
c4f7663c92
Fix error reporting the wrong line for struct field inits ( #13502 )
...
* point to init part of field delc when that's where the error occurs
* update test to reflect fixed error message
* only lookup source location in case of error
2022-11-15 15:17:23 +02:00
Andrew Kelley
a50ad04e85
disable failing test on aarch64-macos
2022-11-14 16:07:52 -07:00
Veikka Tuominen
87cf2783eb
llvm: check that tuple fields have runtime bits
...
Just checking that they aren't comptime isn't enough for `@Type` constructed tuples.
Closes #13531
2022-11-12 15:41:29 +02:00
Veikka Tuominen
a760ce598c
Sema: ensure that !is_comptime and !is_typeof implies sema.func != null
...
Closes #13481
2022-11-12 15:41:29 +02:00
Veikka Tuominen
d42f4abb9d
llvm: correctly lower references to generic functions
...
Closes #13522
2022-11-12 15:41:29 +02:00
Veikka Tuominen
40a2dfc12a
Sema: coerce array operands to shuffle
...
Closes #13494
2022-11-11 18:00:05 +02:00
Veikka Tuominen
9b832e7f53
Sema: make check for namespace lookup of private declarations more strict
...
Previously sema only checked that the private declaration was in the same
file as the lookup but now it also checks that the namespace where
the decl was included from was also in the same file.
Closes #13077
2022-11-11 17:59:53 +02:00
Veikka Tuominen
0a188190b3
AstGen: make pointless discard error more strict
...
The error should only happen as a result of `_ = <expr>` not
for an operand of a break expression that is discarded.
Closes #13212
2022-11-11 17:59:53 +02:00
Veikka Tuominen
d2cc55109a
llvm: correct calculation of index of zero-bit field
...
If the field comes before any non-zero-bit field then the index of
the next field should be returned.
Closes #13363
2022-11-11 17:59:53 +02:00
Veikka Tuominen
c4465556fd
Type: check return_type for generic poison before comparing
...
Closes #13423
2022-11-11 17:59:53 +02:00
Veikka Tuominen
89e8bb409a
AstGen: use condbr_inline if force_comptime is set
...
The `finishThenElseBlock` would correctly use `break_inline`
which would cause Sema to use `addRuntimeBreak` instead of
doing the branch at comptime.
2022-11-11 17:59:53 +02:00
Cody Tapscott
2897641fb9
stage2: Support modifiers in inline asm
...
These are supported using %[ident:mod] syntax. This allows requesting,
e.g., the "w" (32-bit) vs. "x" (64-bit) views of AArch64 registers.
See https://llvm.org/docs/LangRef.html#asm-template-argument-modifiers
2022-11-11 16:01:31 +02:00
Cody Tapscott
b1357091ae
Add test case for #12043
...
This bug is already resolved, just want to make sure we don't lose
the test case. Closes #12043
2022-11-10 12:23:59 -07:00
Cody Tapscott
fbda15632d
stage2 sema: Make vector constants when operating on vectors
...
Resolves https://github.com/ziglang/zig/issues/13058
2022-11-10 12:22:40 -07:00
Cody Tapscott
8f3880074f
stage2: Be more strict about eliding loads
...
This change makes any of the `*_val` instructions check whether it's
safe to elide copies for by-ref types rather than performing this
elision blindly.
AIR instructions fixed:
- .array_elem_val
- .struct_field_val
- .unwrap_errunion_payload
- .try
- .optional_payload
These now all respect value semantics, as expected.
P.S. Thanks to Andrew for the new way to approach this. Many of the
lines here are from his recommended change, which comes with the
significant advantage that loads are now as small as the intervening
memory access allows.
Co-authored by: Andrew Kelley <andrew@ziglang.org>
2022-11-10 12:22:40 -07:00
Cody Tapscott
ff699722da
stage2: Fix comptime array initialization
...
This is a follow-up to 9dc98fba, which made comptime initialization
patterns for union/struct more robust, especially when storing to
comptime-known pointers (and globals).
Resolves #13063 .
2022-11-10 12:22:37 -07:00
Jakub Konka
04b8ce5fd3
Merge branch 'jcmoyer-lld-explicit-pdb'
2022-11-10 16:52:43 +01:00
Jakub Konka
4b3637820d
Merge pull request #13495 from ziglang/macho-dsym
...
stage2: misc DWARF debug info fixes and additions for x86_64 and aarch64
2022-11-10 16:50:57 +01:00
Jakub Konka
1357790ec9
win: combine PDB fixes into one changeset
2022-11-10 14:03:11 +01:00
Jakub Konka
0914e0a4ec
dwarf: do not assume unsigned 64bit integer for the enum value
2022-11-10 09:36:45 +01:00
Jakub Konka
2d5fbbb44e
Merge pull request #13485 from ziglang/arm64-non-null-actual
...
aarch64: optionals
2022-11-09 21:13:50 +01:00
Veikka Tuominen
61842da9f7
llvm: implement packed unions
...
Closes #13340
2022-11-09 17:14:38 +02:00
Jakub Konka
e83590d0e8
aarch64: pass some tests dealing with optionals
2022-11-08 13:59:47 +01:00
Veikka Tuominen
dc128f403b
Merge pull request #13446 from Vexu/stage2-fixes
...
Stage2 bug fixes
2022-11-07 14:17:26 +02:00
Jakub Konka
72769f6cec
link-tests: add test case for parsing weak imports
2022-11-06 15:21:28 +01:00
Jakub Konka
5ef33e7c7e
Merge pull request #13459 from ziglang/issue-13457
...
macho: do not zero-out file if there are no nonzerofill sects
2022-11-06 08:39:13 +01:00
Jakub Konka
aaaa7df152
macho: add linker test case for issue 13457
2022-11-06 00:10:12 +01:00
Veikka Tuominen
5d28d171df
Sema: adjust result type of anyerror field access
...
Closes #13448
2022-11-05 13:22:21 +02:00
Veikka Tuominen
ea48f06fc2
stage2: address of threadlocal variable is not comptime known
...
Closes #13215
2022-11-05 13:22:21 +02:00
Veikka Tuominen
f96748ebc1
Sema: coerce elements of array cat
...
Closes #13347
2022-11-05 13:22:21 +02:00
Veikka Tuominen
f92e7bed7b
stage2: bitsize of packed struct should trigger backing int ty check
...
Closes #13398
2022-11-05 12:54:38 +02:00
Andrew Kelley
1d68045919
Merge pull request #13101 from alichraghi/o4
2022-11-05 02:34:24 -04:00
Veikka Tuominen
51b1083d66
stage2: fix onePossibleValue of empty unions and enums
...
Closes #13402
2022-11-04 23:13:50 +02:00
Veikka Tuominen
42db468dcb
Sema: make method call work with optionals and error unions
...
Closes #13414
2022-11-04 23:13:49 +02:00
Veikka Tuominen
35afa3fd8b
Sema: correct condition in validateArrayInit
...
Closes #13425
2022-11-04 23:13:49 +02:00
Veikka Tuominen
799a558e39
Sema: implement peer type resolution of function pointers and function bodies
...
Closes #13438
2022-11-04 23:13:49 +02:00
Veikka Tuominen
e6b3cb5043
Sema: detect division overflow
...
Closes #13434
2022-11-04 23:13:29 +02:00
Veikka Tuominen
8c4faa5f3f
Merge pull request #13338 from Vexu/stage2-compile-errors
...
Improve some error messages
2022-11-04 16:04:31 +02:00
Micah Switzer
ea54c9a375
Sema: resolve lazy align in zirReify for union fields
...
Closes #13435
2022-11-04 15:48:08 +02:00
Ali Chraghi
f5f1f8c666
all: rename i386 to x86
2022-11-04 00:09:27 +03:30
Nathan Bourgeois
e64eef366c
Translate-C Remainder Macro Fix
2022-11-03 14:07:00 +02:00
Jacob Young
4537c1b8b6
cbe: fix crash rendering union with zero-bit tag
2022-11-02 21:42:40 -04:00
Jacob Young
fa46f9a3d7
cbe: fix extern
2022-11-02 21:42:40 -04:00
Andrew Kelley
e50789f1cb
Merge pull request #13389 from jacobly0/fix-only-c
...
cbe: enough fixes for `-Donly-c` to be able to produce an executable
2022-11-02 15:53:59 -04:00
Andrew Kelley
57dbeb90af
Merge pull request #13396 from Luukdegram/fix-12880
...
llvm: mangle extern function names for Wasm target
2022-11-02 14:10:07 -04:00
Jacob Young
37c104ade0
cbe: ignore comptime fields when generating tuple typedefs
...
This vastly reduces the amount of deduplication state we need to deal with.
2022-11-02 10:21:05 -04:00
Jacob Young
5f31070b8b
cbe: hack around invalid Air
...
Can be changed to `!inst_ty.hisRuntimeBitsIgnoreComptime()` when the
"result location with inferred type ends up being pointer to comptime_int"
test stops producing Air containing a `bitcast(*comptime_int, ...)`.
See #13410
2022-11-02 10:20:31 -04:00
Jacob Young
09763435a8
cbe: support arrays in more places
2022-11-01 20:39:06 -04:00