aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2021-08-30 02:54:03 +0200
committerRobin Voetter <robin@voetter.nl>2021-09-20 02:29:04 +0200
commitc5945467acfd580cb3413250ef52f13dc412a8cf (patch)
treecd56aa35c06a65ec51a3ade3a3bbb90eb33cb8a1 /lib/std
parent7a5d0cdf45f861f63d89666607dc86b3a2810826 (diff)
downloadzig-c5945467acfd580cb3413250ef52f13dc412a8cf.tar.gz
zig-c5945467acfd580cb3413250ef52f13dc412a8cf.zip
Address Spaces: Pointer and function info in @Type
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/builtin.zig2
-rw-r--r--lib/std/mem.zig2
-rw-r--r--lib/std/meta.zig3
-rw-r--r--lib/std/zig/c_translation.zig1
4 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 09d93d5d21..11273eedeb 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -235,6 +235,7 @@ pub const TypeInfo = union(enum) {
is_const: bool,
is_volatile: bool,
alignment: comptime_int,
+ address_space: AddressSpace,
child: type,
is_allowzero: bool,
@@ -364,6 +365,7 @@ pub const TypeInfo = union(enum) {
pub const Fn = struct {
calling_convention: CallingConvention,
alignment: comptime_int,
+ address_space: AddressSpace,
is_generic: bool,
is_var_args: bool,
return_type: ?type,
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index 9eaf185119..95d4c919db 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -2472,6 +2472,7 @@ fn CopyPtrAttrs(comptime source: type, comptime size: std.builtin.TypeInfo.Point
.is_volatile = info.is_volatile,
.is_allowzero = info.is_allowzero,
.alignment = info.alignment,
+ .address_space = info.address_space,
.child = child,
.sentinel = null,
},
@@ -2960,6 +2961,7 @@ fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: u29) typ
.is_volatile = info.is_volatile,
.is_allowzero = info.is_allowzero,
.alignment = new_alignment,
+ .address_space = info.address_space,
.child = info.child,
.sentinel = null,
},
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index a1bfacf597..62866bb711 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -235,6 +235,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
.is_const = info.is_const,
.is_volatile = info.is_volatile,
.alignment = info.alignment,
+ .address_space = info.address_space,
.child = @Type(.{
.Array = .{
.len = array_info.len,
@@ -254,6 +255,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
.is_const = info.is_const,
.is_volatile = info.is_volatile,
.alignment = info.alignment,
+ .address_space = info.address_space,
.child = info.child,
.is_allowzero = info.is_allowzero,
.sentinel = sentinel_val,
@@ -271,6 +273,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
.is_const = ptr_info.is_const,
.is_volatile = ptr_info.is_volatile,
.alignment = ptr_info.alignment,
+ .address_space = ptr_info.address_space,
.child = ptr_info.child,
.is_allowzero = ptr_info.is_allowzero,
.sentinel = sentinel_val,
diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig
index bb8a699f69..999572d212 100644
--- a/lib/std/zig/c_translation.zig
+++ b/lib/std/zig/c_translation.zig
@@ -325,6 +325,7 @@ pub fn FlexibleArrayType(comptime SelfType: type, ElementType: type) type {
.is_const = ptr.is_const,
.is_volatile = ptr.is_volatile,
.alignment = @alignOf(ElementType),
+ .address_space = .generic,
.child = ElementType,
.is_allowzero = true,
.sentinel = null,