aboutsummaryrefslogtreecommitdiff
path: root/src/Type.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-01-03 01:48:42 -0500
committerJacob Young <jacobly0@users.noreply.github.com>2025-01-16 20:47:30 -0500
commit074232b3e53f6a6bbf0851a97c733a848e739bd8 (patch)
tree8ef66708a086caf8a4bc56043ddf3ed170bcd6d1 /src/Type.zig
parent3c74a478a41d2f806f3b9b2bb86fffbc40e100c3 (diff)
downloadzig-074232b3e53f6a6bbf0851a97c733a848e739bd8.tar.gz
zig-074232b3e53f6a6bbf0851a97c733a848e739bd8.zip
x86_64: implement a custom calling convention for the Zig language
Diffstat (limited to 'src/Type.zig')
-rw-r--r--src/Type.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Type.zig b/src/Type.zig
index 2980034a34..c6c4334270 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -1920,6 +1920,17 @@ pub fn isSlice(ty: Type, zcu: *const Zcu) bool {
};
}
+pub fn isSliceAtRuntime(ty: Type, zcu: *const Zcu) bool {
+ return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
+ .ptr_type => |ptr_type| ptr_type.flags.size == .slice,
+ .opt_type => |child| switch (zcu.intern_pool.indexToKey(child)) {
+ .ptr_type => |ptr_type| !ptr_type.flags.is_allowzero and ptr_type.flags.size == .slice,
+ else => false,
+ },
+ else => false,
+ };
+}
+
pub fn slicePtrFieldType(ty: Type, zcu: *const Zcu) Type {
return Type.fromInterned(zcu.intern_pool.slicePtrType(ty.toIntern()));
}