llvm8: fix ZigLLVMCreateFunction
This commit is contained in:
parent
94424e3fa6
commit
75d142c3c7
|
@ -643,14 +643,18 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
|
|||
unsigned line_number = (unsigned)(fn_table_entry->proto_node->line == 0) ?
|
||||
0 : (fn_table_entry->proto_node->line + 1);
|
||||
unsigned scope_line = line_number;
|
||||
bool is_definition = fn_table_entry->body_node != nullptr;
|
||||
bool is_optimized = g->build_mode != BuildModeDebug;
|
||||
bool is_internal_linkage = (fn_table_entry->body_node != nullptr &&
|
||||
fn_table_entry->export_list.length == 0);
|
||||
unsigned flags = 0;
|
||||
ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent);
|
||||
assert(fn_di_scope != nullptr);
|
||||
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,
|
||||
scope_line, flags, nullptr);
|
||||
fn_table_entry->type_entry->di_type, is_internal_linkage,
|
||||
is_definition, scope_line, flags, is_optimized, nullptr);
|
||||
|
||||
scope->di_scope = ZigLLVMSubprogramToScope(subprogram);
|
||||
ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram);
|
||||
|
|
|
@ -594,8 +594,8 @@ ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filena
|
|||
|
||||
ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope,
|
||||
const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno,
|
||||
ZigLLVMDIType *fn_di_type, unsigned scope_line,
|
||||
unsigned flags, ZigLLVMDISubprogram *decl_subprogram)
|
||||
ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line,
|
||||
unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram)
|
||||
{
|
||||
DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type));
|
||||
assert(flags == 0);
|
||||
|
@ -607,7 +607,7 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD
|
|||
di_sub_type,
|
||||
scope_line,
|
||||
DINode::FlagZero,
|
||||
DISubprogram::SPFlagZero,
|
||||
DISubprogram::toSPFlags(is_local_to_unit, is_definition, is_optimized),
|
||||
nullptr,
|
||||
reinterpret_cast<DISubprogram *>(decl_subprogram),
|
||||
nullptr);
|
||||
|
|
|
@ -188,8 +188,9 @@ ZIG_EXTERN_C struct ZigLLVMDIFile *ZigLLVMCreateFile(struct ZigLLVMDIBuilder *di
|
|||
|
||||
ZIG_EXTERN_C struct ZigLLVMDISubprogram *ZigLLVMCreateFunction(struct ZigLLVMDIBuilder *dibuilder,
|
||||
struct ZigLLVMDIScope *scope, const char *name, const char *linkage_name, struct ZigLLVMDIFile *file,
|
||||
unsigned lineno, struct ZigLLVMDIType *fn_di_type,
|
||||
unsigned scope_line, unsigned flags, struct ZigLLVMDISubprogram *decl_subprogram);
|
||||
unsigned lineno, struct ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition,
|
||||
unsigned scope_line, unsigned flags, bool is_optimized, struct ZigLLVMDISubprogram *decl_subprogram);
|
||||
|
||||
|
||||
ZIG_EXTERN_C void ZigLLVMFnSetSubprogram(LLVMValueRef fn, struct ZigLLVMDISubprogram *subprogram);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user