Compare commits
1 Commits
c13194d626
...
95e50753bf
Author | SHA1 | Date | |
---|---|---|---|
95e50753bf |
@ -7094,7 +7094,7 @@ fn void emit_macro_instantiation(Module* module, Value* value)
|
||||
}
|
||||
}
|
||||
|
||||
fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u32* last_line, u32* last_column, LLVMMetadataRef* last_debug_location);
|
||||
fn void analyze_statement(Module* module, Scope* scope, Statement* statement);
|
||||
|
||||
fn void analyze_block(Module* module, Block* block)
|
||||
{
|
||||
@ -7110,7 +7110,7 @@ fn void analyze_block(Module* module, Block* block)
|
||||
|
||||
for (auto* statement = block->first_statement; statement; statement = statement->next)
|
||||
{
|
||||
analyze_statement(module, &block->scope, statement, &last_line, &last_column, &last_debug_location);
|
||||
analyze_statement(module, &block->scope, statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8220,7 +8220,7 @@ fn void analyze_value(Module* module, Value* value, Type* expected_type, TypeKin
|
||||
emit_value(module, value, type_kind, must_be_constant);
|
||||
}
|
||||
|
||||
fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u32* last_line, u32* last_column, LLVMMetadataRef* last_debug_location)
|
||||
fn void analyze_statement(Module* module, Scope* scope, Statement* statement)
|
||||
{
|
||||
Global* parent_function_global;
|
||||
if (module->current_function)
|
||||
@ -8239,16 +8239,12 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
auto* llvm_function = parent_function_global->variable.storage->llvm;
|
||||
assert(llvm_function);
|
||||
|
||||
LLVMMetadataRef statement_location = 0;
|
||||
|
||||
if (module->has_debug_info)
|
||||
{
|
||||
if (statement->line != *last_line || statement->column != *last_column)
|
||||
{
|
||||
auto new_location = LLVMDIBuilderCreateDebugLocation(module->llvm.context, statement->line, statement->column, scope->llvm, module->llvm.inlined_at);
|
||||
*last_debug_location = new_location;
|
||||
LLVMSetCurrentDebugLocation2(module->llvm.builder, new_location);
|
||||
*last_line = statement->line;
|
||||
*last_column = statement->column;
|
||||
}
|
||||
statement_location = LLVMDIBuilderCreateDebugLocation(module->llvm.context, statement->line, statement->column, scope->llvm, module->llvm.inlined_at);
|
||||
LLVMSetCurrentDebugLocation2(module->llvm.builder, statement_location);
|
||||
}
|
||||
|
||||
switch (statement->id)
|
||||
@ -8280,7 +8276,7 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
{
|
||||
if (module->has_debug_info)
|
||||
{
|
||||
LLVMSetCurrentDebugLocation2(module->llvm.builder, *last_debug_location);
|
||||
LLVMSetCurrentDebugLocation2(module->llvm.builder, statement_location);
|
||||
}
|
||||
|
||||
auto return_alloca = module->current_function->variable.storage->function.llvm.return_alloca;
|
||||
@ -8347,7 +8343,7 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
LLVMBuildCondBr(module->llvm.builder, llvm_condition, taken_block, not_taken_block);
|
||||
LLVMPositionBuilderAtEnd(module->llvm.builder, taken_block);
|
||||
|
||||
analyze_statement(module, scope, statement->if_st.if_statement, last_line, last_column, last_debug_location);
|
||||
analyze_statement(module, scope, statement->if_st.if_statement);
|
||||
|
||||
if (LLVMGetInsertBlock(module->llvm.builder))
|
||||
{
|
||||
@ -8358,7 +8354,7 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
auto else_statement = statement->if_st.else_statement;
|
||||
if (else_statement)
|
||||
{
|
||||
analyze_statement(module, scope, else_statement, last_line, last_column, last_debug_location);
|
||||
analyze_statement(module, scope, else_statement);
|
||||
}
|
||||
|
||||
if (LLVMGetInsertBlock(module->llvm.builder))
|
||||
@ -8993,7 +8989,7 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
|
||||
assert(!local);
|
||||
|
||||
analyze_statement(module, &statement->for_each.scope, statement->for_each.predicate, last_line, last_column, last_debug_location);
|
||||
analyze_statement(module, &statement->for_each.scope, statement->for_each.predicate);
|
||||
|
||||
if (LLVMGetInsertBlock(module->llvm.builder))
|
||||
{
|
||||
@ -9097,7 +9093,7 @@ fn void analyze_statement(Module* module, Scope* scope, Statement* statement, u3
|
||||
LLVMBuildCondBr(module->llvm.builder, index_compare, body_block, exit_block);
|
||||
|
||||
LLVMPositionBuilderAtEnd(module->llvm.builder, body_block);
|
||||
analyze_statement(module, &statement->for_each.scope, statement->for_each.predicate, last_line, last_column, last_debug_location);
|
||||
analyze_statement(module, &statement->for_each.scope, statement->for_each.predicate);
|
||||
|
||||
if (LLVMGetInsertBlock(module->llvm.builder))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user