zig/test/cases/llvm
mlugg 4976b58ab1
Prevent analysis of functions only referenced at comptime
The idea here is that there are two ways we can reference a function at runtime:

* Through a direct call, i.e. where the function is comptime-known
* Through a function pointer

This means we can easily perform a form of rudimentary escape analysis
on functions. If we ever see a `decl_ref` or `ref` of a function, we
have a function pointer, which could "leak" into runtime code, so we
emit the function; but for a plain `decl_val`, there's no need to.

This change means that `comptime { _ = f; }` no longer forces a function
to be emitted, which was used for some things (mainly tests). These use
sites have been replaced with `_ = &f;`, which still triggers analysis
of the function body, since you're taking a pointer to the function.

Resolves: #6256
Resolves: #15353
2023-05-29 23:06:08 +01:00
..
address_space_pointer_access_chaining_pointer_to_optional_array.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
address_spaces_pointer_access_chaining_array_pointer.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
address_spaces_pointer_access_chaining_complex.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
address_spaces_pointer_access_chaining_struct_pointer.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
blocks.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
dereferencing_though_multiple_pointers_with_address_spaces.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
f_segment_address_space_reading_and_writing.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
for_loop.zig disable failing x86_64 backend tests 2023-02-18 19:17:21 -07:00
hello_world.zig test-cases: fix incorrectly linking libc when backend is llvm 2023-03-15 10:48:15 -07:00
nested_blocks.zig test: fix spurious whitespace in nested_blocks test 2022-06-28 13:28:09 +02:00
optionals.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
pointer_keeps_address_space_when_taking_address_of_dereference.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
pointer_keeps_address_space.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
rem.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
simple_addition_and_subtraction.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
simple_if_statement.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
while_loops.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00