mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
fix debug info for function pointers
found when testing against LLVM 8 see https://bugs.llvm.org/show_bug.cgi?id=40198
This commit is contained in:
parent
013c7b24d2
commit
aa65b94671
@ -1166,6 +1166,7 @@ struct ZigTypeFn {
|
||||
FnGenParamInfo *gen_param_info;
|
||||
|
||||
LLVMTypeRef raw_type_ref;
|
||||
ZigLLVMDIType *raw_di_type;
|
||||
|
||||
ZigType *bound_fn_parent;
|
||||
};
|
||||
|
||||
@ -1220,7 +1220,10 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
|
||||
fn_type->data.fn.raw_type_ref = LLVMFunctionType(gen_return_type->type_ref,
|
||||
gen_param_types.items, (unsigned int)gen_param_types.length, fn_type_id->is_var_args);
|
||||
fn_type->type_ref = LLVMPointerType(fn_type->data.fn.raw_type_ref, 0);
|
||||
fn_type->di_type = ZigLLVMCreateSubroutineType(g->dbuilder, param_di_types.items, (int)param_di_types.length, 0);
|
||||
fn_type->data.fn.raw_di_type = ZigLLVMCreateSubroutineType(g->dbuilder, param_di_types.items, (int)param_di_types.length, 0);
|
||||
fn_type->di_type = ZigLLVMCreateDebugPointerType(g->dbuilder, fn_type->data.fn.raw_di_type,
|
||||
LLVMStoreSizeOfType(g->target_data_ref, fn_type->type_ref),
|
||||
LLVMABIAlignmentOfType(g->target_data_ref, fn_type->type_ref), "");
|
||||
}
|
||||
|
||||
g->fn_type_table.put(&fn_type->data.fn.fn_type_id, fn_type);
|
||||
|
||||
@ -649,7 +649,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
|
||||
ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder,
|
||||
fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "",
|
||||
import->di_file, line_number,
|
||||
fn_table_entry->type_entry->di_type, is_internal_linkage,
|
||||
fn_table_entry->type_entry->data.fn.raw_di_type, is_internal_linkage,
|
||||
is_definition, scope_line, flags, is_optimized, nullptr);
|
||||
|
||||
scope->di_scope = ZigLLVMSubprogramToScope(subprogram);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user