aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2022-12-26 23:13:01 -0500
committerJacob Young <jacobly0@users.noreply.github.com>2022-12-27 00:12:56 -0500
commit81318e870418d017244d6d133aabca19f2c63b58 (patch)
treecf2798c2ada2b1901f6e2129ea45c6566c40febe /src/codegen/llvm.zig
parent46b49a0a766a39ca37ba48f1a1c2ed28c260b08b (diff)
downloadzig-81318e870418d017244d6d133aabca19f2c63b58.tar.gz
zig-81318e870418d017244d6d133aabca19f2c63b58.zip
llvm: add asserts and behavior tests for #14063
Closes #14063
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 49cf0ff9f0..887e8d2bfc 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1928,6 +1928,7 @@ pub const Object = struct {
if (ty.castTag(.@"struct")) |payload| {
const struct_obj = payload.data;
if (struct_obj.layout == .Packed and struct_obj.haveFieldTypes()) {
+ assert(struct_obj.haveLayout());
const info = struct_obj.backing_int_ty.intInfo(target);
const dwarf_encoding: c_uint = switch (info.signedness) {
.signed => DW.ATE.signed,
@@ -2931,6 +2932,7 @@ pub const DeclGen = struct {
const struct_obj = t.castTag(.@"struct").?.data;
if (struct_obj.layout == .Packed) {
+ assert(struct_obj.haveLayout());
const int_llvm_ty = try dg.lowerType(struct_obj.backing_int_ty);
gop.value_ptr.* = int_llvm_ty;
return int_llvm_ty;
@@ -3632,6 +3634,7 @@ pub const DeclGen = struct {
const struct_obj = tv.ty.castTag(.@"struct").?.data;
if (struct_obj.layout == .Packed) {
+ assert(struct_obj.haveLayout());
const big_bits = struct_obj.backing_int_ty.bitSize(target);
const int_llvm_ty = dg.context.intType(@intCast(c_uint, big_bits));
const fields = struct_obj.fields.values();
@@ -9152,6 +9155,7 @@ pub const FuncGen = struct {
.Struct => {
if (result_ty.containerLayout() == .Packed) {
const struct_obj = result_ty.castTag(.@"struct").?.data;
+ assert(struct_obj.haveLayout());
const big_bits = struct_obj.backing_int_ty.bitSize(target);
const int_llvm_ty = self.context.intType(@intCast(c_uint, big_bits));
const fields = struct_obj.fields.values();