mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Minor cleanup and remove unused
Also relaxed unnecessary constraint on ast fields for the using dbg.
This commit is contained in:
@@ -2527,9 +2527,8 @@ gb_internal void lb_build_assign_stmt(lbProcedure *p, AstAssignStmt *as) {
|
|||||||
// NOTE(Ed) - Sectr Fork: Added for namespaced names on using statements in debug
|
// NOTE(Ed) - Sectr Fork: Added for namespaced names on using statements in debug
|
||||||
// Format: struct_name::field_name
|
// Format: struct_name::field_name
|
||||||
// I tired todo struct_name.field_name it didn't work (nor using struct_name.field_name)
|
// I tired todo struct_name.field_name it didn't work (nor using struct_name.field_name)
|
||||||
char* debug_lb_make_using_struct_ref_identifier(gbAllocator allocator, String struct_name, String field_name)
|
char* debug_lb_make_using_struct_ref_identifier(gbAllocator allocator, String struct_name, String field_name) {
|
||||||
{
|
isize name_len = 2 + struct_name.len + 1 + field_name.len + 1;
|
||||||
isize name_len = 6 + struct_name.len + 1 + field_name.len + 1;
|
|
||||||
char* debug_name = gb_alloc_array(allocator, char, name_len);
|
char* debug_name = gb_alloc_array(allocator, char, name_len);
|
||||||
gb_snprintf(debug_name, name_len, "%.*s::%.*s"
|
gb_snprintf(debug_name, name_len, "%.*s::%.*s"
|
||||||
, LIT(struct_name)
|
, LIT(struct_name)
|
||||||
@@ -2593,21 +2592,6 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Ast* ast_field : us->list )
|
|
||||||
{
|
|
||||||
if (is_blank_ident(ast_field)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
GB_ASSERT(ast_field->kind == Ast_Ident);
|
|
||||||
Entity* entity_field = entity_of_node(ast_field);
|
|
||||||
TokenPos pos = ast_token(ast_field).pos;
|
|
||||||
|
|
||||||
GB_ASSERT_MSG(entity_field != nullptr, "\n% missing child entity %.*s for using statement"
|
|
||||||
, token_pos_to_string(pos), LIT(ast_field->Ident.token.string)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEMPORARY_ALLOCATOR_GUARD();
|
TEMPORARY_ALLOCATOR_GUARD();
|
||||||
|
|
||||||
for ( Ast* ast_var : us->list )
|
for ( Ast* ast_var : us->list )
|
||||||
@@ -2615,16 +2599,10 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
|
|||||||
if (is_blank_ident(ast_var)) {
|
if (is_blank_ident(ast_var)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity* ent_var = entity_of_node(ast_var);
|
Entity* ent_var = entity_of_node(ast_var);
|
||||||
if (ent_var->kind != Entity_Variable ) {
|
if (ent_var->kind != Entity_Variable ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Type* type = base_type(type_deref(ent_var->type));
|
|
||||||
if (type == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type* struct_type = base_type(type_deref(ent_var->type));
|
Type* struct_type = base_type(type_deref(ent_var->type));
|
||||||
if (struct_type == nullptr || struct_type->kind != Type_Struct) {
|
if (struct_type == nullptr || struct_type->kind != Type_Struct) {
|
||||||
continue;
|
continue;
|
||||||
@@ -2642,7 +2620,6 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
|
|||||||
if (field->kind != Entity_Variable || ! (field->flags & EntityFlag_Field)) {
|
if (field->kind != Entity_Variable || ! (field->flags & EntityFlag_Field)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type* type_ptr_field_type = alloc_type_pointer(field->type);
|
Type* type_ptr_field_type = alloc_type_pointer(field->type);
|
||||||
|
|
||||||
Token debug_token = field->token;
|
Token debug_token = field->token;
|
||||||
@@ -2652,9 +2629,7 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
|
|||||||
Entity* debug_field = alloc_entity_variable(field->scope, debug_token, field->type);
|
Entity* debug_field = alloc_entity_variable(field->scope, debug_token, field->type);
|
||||||
Selection sel_field = lookup_field_from_index(struct_type, field->Variable.field_index);
|
Selection sel_field = lookup_field_from_index(struct_type, field->Variable.field_index);
|
||||||
|
|
||||||
// Create debug variable for field access
|
lbAddr field_debug_ptr = lb_add_local(p, type_ptr_field_type, debug_field, false);
|
||||||
lbAddr field_debug_ptr = lb_add_local (p, type_ptr_field_type, debug_field, false);
|
|
||||||
// lbAddr field_debug_ptr = lb_add_local (p, type_ptr_field_type, field, false);
|
|
||||||
lbValue field_ptr = lb_emit_deep_field_gep(p, struct_ptr, sel_field);
|
lbValue field_ptr = lb_emit_deep_field_gep(p, struct_ptr, sel_field);
|
||||||
lb_addr_store(p, field_debug_ptr, field_ptr);
|
lb_addr_store(p, field_debug_ptr, field_ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user