stage2: make hasCodeGenBits() always true for pointers

* LLVM backend: The `alloc` AIR instruction as well as pointer
   constants which point to a 0-bit element type now call a common
   codepath to produce a `*const llvm.Value` which is a non-zero pointer
   with a bogus-but-properly-aligned address.
 * LLVM backend: improve the lowering of optional types.
 * Type: `hasCodeGenBits()` now returns `true` for pointers even when
   it returns `false` for their element types.

Effectively, #6706 is now implemented in stage2 but not stage1.
This commit is contained in:
Andrew Kelley
2021-10-15 17:17:59 -07:00
parent 0536c25578
commit 186126c2a4
6 changed files with 83 additions and 38 deletions

View File

@@ -246,7 +246,7 @@ fn testTakeAddressOfParameter(f: f32) !void {
}
test "pointer to void return type" {
testPointerToVoidReturnType() catch unreachable;
try testPointerToVoidReturnType();
}
fn testPointerToVoidReturnType() anyerror!void {
const a = testPointerToVoidReturnType2();