aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index a24c14c9c6..7038606611 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -3938,6 +3938,15 @@ pub const DeclGen = struct {
const parent_llvm_ty = try dg.lowerType(parent_ty);
break :blk parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len);
},
+ .Pointer => {
+ assert(parent_ty.isSlice());
+ const indices: [2]*llvm.Value = .{
+ llvm_u32.constInt(0, .False),
+ llvm_u32.constInt(field_index, .False),
+ };
+ const parent_llvm_ty = try dg.lowerType(parent_ty);
+ break :blk parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len);
+ },
else => unreachable,
}
},
@@ -8897,7 +8906,7 @@ pub const FuncGen = struct {
return union_llvm_ty.constInt(tag_int, .False);
}
assert(isByRef(union_ty));
- // The llvm type of the alloca will the the named LLVM union type, which will not
+ // The llvm type of the alloca will be the named LLVM union type, and will not
// necessarily match the format that we need, depending on which tag is active. We
// must construct the correct unnamed struct type here and bitcast, in order to
// then set the fields appropriately.
@@ -8922,7 +8931,7 @@ pub const FuncGen = struct {
const fields: [2]*llvm.Type = .{
field_llvm_ty, self.context.intType(8).arrayType(padding_len),
};
- break :p self.context.structType(&fields, fields.len, .False);
+ break :p self.context.structType(&fields, fields.len, .True);
};
if (layout.tag_size == 0) {
const fields: [1]*llvm.Type = .{payload};