diff options
| author | Robin Voetter <robin@voetter.nl> | 2021-08-20 02:53:29 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2021-09-20 02:29:03 +0200 |
| commit | cd9f6001af407a6961281cbe9c658cfe94b81ecb (patch) | |
| tree | 348a4612ec8bcc0b89368955932615cecc6f4634 /src/type.zig | |
| parent | 60231086508d26689d53b8bc545e8fe98cad966d (diff) | |
| download | zig-cd9f6001af407a6961281cbe9c658cfe94b81ecb.tar.gz zig-cd9f6001af407a6961281cbe9c658cfe94b81ecb.zip | |
Address Spaces: decl_ref, *?T => *T, and *(E!T) -> *T
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig index 647d88c60f..b15026b595 100644 --- a/src/type.zig +++ b/src/type.zig @@ -1526,6 +1526,30 @@ pub const Type = extern union { } } + pub fn ptrAddressSpace(self: Type) std.builtin.AddressSpace { + return switch (self.tag()) { + .single_const_pointer_to_comptime_int, + .const_slice_u8, + .single_const_pointer, + .single_mut_pointer, + .many_const_pointer, + .many_mut_pointer, + .c_const_pointer, + .c_mut_pointer, + .const_slice, + .mut_slice, + .inferred_alloc_const, + .inferred_alloc_mut, + .manyptr_u8, + .manyptr_const_u8, + => .generic, + + .pointer => self.castTag(.pointer).?.data.@"addrspace", + + else => unreachable, + }; + } + /// Asserts that hasCodeGenBits() is true. pub fn abiAlignment(self: Type, target: Target) u32 { return switch (self.tag()) { |
