aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-14 23:24:57 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-14 23:24:57 -0700
commit040cb585e88583cba8a15f30eea07bfd2f135515 (patch)
tree1a7be73e85d8a92d09f148924b219cac1d59f55d /src/type.zig
parent8c14d170b579e078ff961973e4d28a4946df36d7 (diff)
downloadzig-040cb585e88583cba8a15f30eea07bfd2f135515.tar.gz
zig-040cb585e88583cba8a15f30eea07bfd2f135515.zip
LLVM: fix ABI size of optional and error union types
Previously, the Zig ABI size and LLVM ABI size of these types disagreed sometimes. This code also corrects the logging messages to not trigger LLVM assertions.
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig
index 0744a50579..59f0668770 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2305,6 +2305,9 @@ pub const Type = extern union {
/// true if and only if the type takes up space in memory at runtime.
/// There are two reasons a type will return false:
/// * the type is a comptime-only type. For example, the type `type` itself.
+ /// - note, however, that a struct can have mixed fields and only the non-comptime-only
+ /// fields will count towards the ABI size. For example, `struct {T: type, x: i32}`
+ /// hasRuntimeBits()=true and abiSize()=4
/// * the type has only one possible value, making its ABI size 0.
/// When `ignore_comptime_only` is true, then types that are comptime only
/// may return false positives.