From 4bac22e88898158fc49e69db5bbe26a324797d68 Mon Sep 17 00:00:00 2001 From: Sahnvour Date: Sat, 2 Mar 2019 18:12:56 +0100 Subject: all integers returned by @typeInfo are now comptime_int --- src/codegen.cpp | 16 ++++++++-------- src/ir.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/codegen.cpp b/src/codegen.cpp index 77832e215d..52e20108de 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7492,18 +7492,18 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { "\n\n" " pub const Int = struct {\n" " is_signed: bool,\n" - " bits: u8,\n" + " bits: comptime_int,\n" " };\n" "\n" " pub const Float = struct {\n" - " bits: u8,\n" + " bits: comptime_int,\n" " };\n" "\n" " pub const Pointer = struct {\n" " size: Size,\n" " is_const: bool,\n" " is_volatile: bool,\n" - " alignment: u32,\n" + " alignment: comptime_int,\n" " child: type,\n" "\n" " pub const Size = enum {\n" @@ -7515,7 +7515,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { " };\n" "\n" " pub const Array = struct {\n" - " len: usize,\n" + " len: comptime_int,\n" " child: type,\n" " };\n" "\n" @@ -7527,7 +7527,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { "\n" " pub const StructField = struct {\n" " name: []const u8,\n" - " offset: ?usize,\n" + " offset: ?comptime_int,\n" " field_type: type,\n" " };\n" "\n" @@ -7548,7 +7548,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { "\n" " pub const Error = struct {\n" " name: []const u8,\n" - " value: usize,\n" + " value: comptime_int,\n" " };\n" "\n" " pub const ErrorSet = struct {\n" @@ -7557,7 +7557,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { "\n" " pub const EnumField = struct {\n" " name: []const u8,\n" - " value: usize,\n" + " value: comptime_int,\n" " };\n" "\n" " pub const Enum = struct {\n" @@ -7609,7 +7609,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { " };\n" "\n" " pub const Vector = struct {\n" - " len: u32,\n" + " len: comptime_int,\n" " child: type,\n" " };\n" "\n" diff --git a/src/ir.cpp b/src/ir.cpp index 2452011d79..e081b4b052 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -17997,7 +17997,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_ty // alignment: u32 ensure_field_index(result->type, "alignment", 3); fields[3].special = ConstValSpecialStatic; - fields[3].type = get_int_type(ira->codegen, false, 29); + fields[3].type = ira->codegen->builtin_types.entry_num_lit_int; bigint_init_unsigned(&fields[3].data.x_bigint, get_ptr_align(ira->codegen, attrs_type)); // child: type ensure_field_index(result->type, "child", 4); @@ -18016,7 +18016,7 @@ static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, ConstExprValue *inner_fields = create_const_vals(2); inner_fields[1].special = ConstValSpecialStatic; - inner_fields[1].type = ira->codegen->builtin_types.entry_usize; + inner_fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; ConstExprValue *name = create_const_str_lit(ira->codegen, enum_field->name); init_const_slice(ira->codegen, &inner_fields[0], name, 0, buf_len(enum_field->name), true); @@ -18080,7 +18080,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr // bits: u8 ensure_field_index(result->type, "bits", 1); fields[1].special = ConstValSpecialStatic; - fields[1].type = ira->codegen->builtin_types.entry_u8; + fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; bigint_init_unsigned(&fields[1].data.x_bigint, type_entry->data.integral.bit_count); break; @@ -18097,7 +18097,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr // bits: u8 ensure_field_index(result->type, "bits", 0); fields[0].special = ConstValSpecialStatic; - fields[0].type = ira->codegen->builtin_types.entry_u8; + fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; bigint_init_unsigned(&fields->data.x_bigint, type_entry->data.floating.bit_count); break; @@ -18121,7 +18121,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr // len: usize ensure_field_index(result->type, "len", 0); fields[0].special = ConstValSpecialStatic; - fields[0].type = ira->codegen->builtin_types.entry_usize; + fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; bigint_init_unsigned(&fields[0].data.x_bigint, type_entry->data.array.len); // child: type ensure_field_index(result->type, "child", 1); @@ -18142,7 +18142,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr // len: usize ensure_field_index(result->type, "len", 0); fields[0].special = ConstValSpecialStatic; - fields[0].type = ira->codegen->builtin_types.entry_u32; + fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; bigint_init_unsigned(&fields[0].data.x_bigint, type_entry->data.vector.len); // child: type ensure_field_index(result->type, "child", 1); @@ -18286,7 +18286,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr ConstExprValue *inner_fields = create_const_vals(2); inner_fields[1].special = ConstValSpecialStatic; - inner_fields[1].type = ira->codegen->builtin_types.entry_usize; + inner_fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; ConstExprValue *name = nullptr; if (error->cached_error_name_val != nullptr) @@ -18458,7 +18458,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr ConstExprValue *inner_fields = create_const_vals(3); inner_fields[1].special = ConstValSpecialStatic; - inner_fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_usize); + inner_fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int); if (!type_has_bits(struct_field->type_entry)) { inner_fields[1].data.x_optional = nullptr; -- cgit v1.2.3