From c6ace9720c8666f893f236c00ea9b370b1b2bb70 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 1 Dec 2016 13:55:56 -0500 Subject: rename BlockContext to Scope --- src/codegen.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 28020356d1..ebf5ae530e 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -228,8 +228,8 @@ static void render_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstExprVa static void render_const_val_global(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *const_val); static void set_debug_source_node(CodeGen *g, AstNode *node) { - assert(node->block_context); - ZigLLVMSetCurrentDebugLocation(g->builder, node->line + 1, node->column + 1, node->block_context->di_scope); + assert(node->scope); + ZigLLVMSetCurrentDebugLocation(g->builder, node->line + 1, node->column + 1, node->scope->di_scope); } static void clear_debug_source_node(CodeGen *g) { @@ -312,7 +312,7 @@ static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, TypeTableEntr } } -static bool want_debug_safety_recursive(CodeGen *g, BlockContext *context) { +static bool want_debug_safety_recursive(CodeGen *g, Scope *context) { if (context->safety_set_node || !context->parent) { return !context->safety_off; } @@ -325,7 +325,7 @@ static bool want_debug_safety(CodeGen *g, AstNode *node) { if (g->is_release_build) { return false; } - return want_debug_safety_recursive(g, node->block_context); + return want_debug_safety_recursive(g, node->scope); } static bool ir_want_debug_safety(CodeGen *g, IrInstruction *instruction) { @@ -558,10 +558,10 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, AstNode *source_node, } static void gen_var_debug_decl(CodeGen *g, VariableTableEntry *var) { - BlockContext *block_context = var->block_context; + Scope *scope = var->scope; AstNode *source_node = var->decl_node; ZigLLVMDILocation *debug_loc = ZigLLVMGetDebugLoc(source_node->line + 1, source_node->column + 1, - block_context->di_scope); + scope->di_scope); ZigLLVMInsertDeclareAtEnd(g->dbuilder, var->value_ref, var->di_loc_var, debug_loc, LLVMGetInsertBlock(g->builder)); } @@ -2134,7 +2134,7 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini assert(type_entry); bool is_local_to_unit = true; ZigLLVMCreateGlobalVariable(g->dbuilder, - var->block_context->di_scope, buf_ptr(&var->name), + var->scope->di_scope, buf_ptr(&var->name), buf_ptr(&var->name), var->import->di_file, var->decl_node->line + 1, type_entry->di_type, is_local_to_unit, init_val); } @@ -2332,15 +2332,15 @@ static void do_code_gen(CodeGen *g) { // Set up debug info for blocks for (size_t bc_i = 0; bc_i < fn_table_entry->all_block_contexts.length; bc_i += 1) { - BlockContext *block_context = fn_table_entry->all_block_contexts.at(bc_i); + Scope *scope = fn_table_entry->all_block_contexts.at(bc_i); - if (!block_context->di_scope) { + if (!scope->di_scope) { ZigLLVMDILexicalBlock *di_block = ZigLLVMCreateLexicalBlock(g->dbuilder, - block_context->parent->di_scope, + scope->parent->di_scope, import->di_file, - block_context->node->line + 1, - block_context->node->column + 1); - block_context->di_scope = ZigLLVMLexicalBlockToScope(di_block); + scope->node->line + 1, + scope->node->column + 1); + scope->di_scope = ZigLLVMLexicalBlockToScope(di_block); } @@ -2383,7 +2383,7 @@ static void do_code_gen(CodeGen *g) { if (var->is_inline) continue; - if (var->block_context->node->type == NodeTypeFnDef) { + if (var->scope->node->type == NodeTypeFnDef) { assert(var->gen_arg_index != SIZE_MAX); TypeTableEntry *gen_type; if (handle_is_ptr(var->type)) { @@ -2395,7 +2395,7 @@ static void do_code_gen(CodeGen *g) { unsigned align_bytes = ZigLLVMGetPrefTypeAlignment(g->target_data_ref, var->type->type_ref); LLVMSetAlignment(var->value_ref, align_bytes); } - var->di_loc_var = ZigLLVMCreateParameterVariable(g->dbuilder, var->block_context->di_scope, + var->di_loc_var = ZigLLVMCreateParameterVariable(g->dbuilder, var->scope->di_scope, buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, gen_type->di_type, !g->strip_debug_symbols, 0, var->gen_arg_index + 1); @@ -2406,7 +2406,7 @@ static void do_code_gen(CodeGen *g) { unsigned align_bytes = ZigLLVMGetPrefTypeAlignment(g->target_data_ref, var->type->type_ref); LLVMSetAlignment(var->value_ref, align_bytes); - var->di_loc_var = ZigLLVMCreateAutoVariable(g->dbuilder, var->block_context->di_scope, + var->di_loc_var = ZigLLVMCreateAutoVariable(g->dbuilder, var->scope->di_scope, buf_ptr(&var->name), import->di_file, var->decl_node->line + 1, var->type->di_type, !g->strip_debug_symbols, 0); } -- cgit v1.2.3