mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 19:00:06 +00:00
Remove hash field in runtime.Source_Code_Location
This commit is contained in:
-13
@@ -458,7 +458,6 @@ struct irValueSourceCodeLocation {
|
||||
irValue *line;
|
||||
irValue *column;
|
||||
irValue *procedure;
|
||||
u64 hash;
|
||||
};
|
||||
|
||||
|
||||
@@ -7176,17 +7175,6 @@ bool is_double_pointer(Type *t) {
|
||||
return is_type_pointer(td);
|
||||
}
|
||||
|
||||
|
||||
u64 ir_generate_source_code_location_hash(TokenPos pos) {
|
||||
u64 h = 0xcbf29ce484222325;
|
||||
for (isize i = 0; i < pos.file.len; i++) {
|
||||
h = (h ^ u64(pos.file[i])) * 0x100000001b3;
|
||||
}
|
||||
h = h ^ (u64(pos.line) * 0x100000001b3);
|
||||
h = h ^ (u64(pos.column) * 0x100000001b3);
|
||||
return h;
|
||||
}
|
||||
|
||||
irValue *ir_emit_source_code_location(irProcedure *proc, String procedure, TokenPos pos) {
|
||||
gbAllocator a = ir_allocator();
|
||||
irValue *v = ir_alloc_value(irValue_SourceCodeLocation);
|
||||
@@ -7194,7 +7182,6 @@ irValue *ir_emit_source_code_location(irProcedure *proc, String procedure, Token
|
||||
v->SourceCodeLocation.line = ir_const_int(pos.line);
|
||||
v->SourceCodeLocation.column = ir_const_int(pos.column);
|
||||
v->SourceCodeLocation.procedure = ir_find_or_add_entity_string(proc->module, procedure);
|
||||
v->SourceCodeLocation.hash = ir_generate_source_code_location_hash(pos);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -1430,7 +1430,6 @@ void ir_print_value(irFileBuffer *f, irModule *m, irValue *value, Type *type_hin
|
||||
irValue *line = value->SourceCodeLocation.line;
|
||||
irValue *column = value->SourceCodeLocation.column;
|
||||
irValue *procedure = value->SourceCodeLocation.procedure;
|
||||
u64 hash = value->SourceCodeLocation.hash;
|
||||
|
||||
ir_write_byte(f, '{');
|
||||
ir_print_type(f, m, t_string); ir_write_byte(f, ' '); ir_print_value(f, m, file, t_string);
|
||||
@@ -1440,8 +1439,6 @@ void ir_print_value(irFileBuffer *f, irModule *m, irValue *value, Type *type_hin
|
||||
ir_print_type(f, m, t_int); ir_write_byte(f, ' '); ir_print_value(f, m, column, t_int);
|
||||
ir_write_string(f, str_lit(", "));
|
||||
ir_print_type(f, m, t_string); ir_write_byte(f, ' '); ir_print_value(f, m, procedure, t_string);
|
||||
ir_write_string(f, str_lit(", "));
|
||||
ir_print_type(f, m, t_u64); ir_write_byte(f, ' '); ir_write_u64(f, hash);
|
||||
ir_write_byte(f, '}');
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-13
@@ -5667,28 +5667,17 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc
|
||||
return lb_const_nil(m, original_type);
|
||||
}
|
||||
|
||||
u64 lb_generate_source_code_location_hash(TokenPos const &pos) {
|
||||
u64 h = 0xcbf29ce484222325;
|
||||
for (isize i = 0; i < pos.file.len; i++) {
|
||||
h = (h ^ u64(pos.file[i])) * 0x100000001b3;
|
||||
}
|
||||
h = h ^ (u64(pos.line) * 0x100000001b3);
|
||||
h = h ^ (u64(pos.column) * 0x100000001b3);
|
||||
return h;
|
||||
}
|
||||
|
||||
lbValue lb_emit_source_code_location(lbProcedure *p, String const &procedure, TokenPos const &pos) {
|
||||
lbModule *m = p->module;
|
||||
|
||||
LLVMValueRef fields[5] = {};
|
||||
LLVMValueRef fields[4] = {};
|
||||
fields[0]/*file*/ = lb_find_or_add_entity_string(p->module, pos.file).value;
|
||||
fields[1]/*line*/ = lb_const_int(m, t_int, pos.line).value;
|
||||
fields[2]/*column*/ = lb_const_int(m, t_int, pos.column).value;
|
||||
fields[3]/*procedure*/ = lb_find_or_add_entity_string(p->module, procedure).value;
|
||||
fields[4]/*hash*/ = lb_const_int(m, t_u64, lb_generate_source_code_location_hash(pos)).value;
|
||||
|
||||
lbValue res = {};
|
||||
res.value = LLVMConstNamedStruct(lb_type(m, t_source_code_location), fields, 5);
|
||||
res.value = LLVMConstNamedStruct(lb_type(m, t_source_code_location), fields, gb_count_of(fields));
|
||||
res.type = t_source_code_location;
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user