aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2018-12-23 18:22:30 -0500
committerAndrew Kelley <andrew@ziglang.org>2018-12-23 18:22:30 -0500
commit75d142c3c78ef786801dcf85f44d16a6530f02d2 (patch)
tree046e03de2fc156bbf45379f8d2b58c643edfb249 /src/codegen.cpp
parent94424e3fa6d0bbcfb9bbaaff040913d5445fdd51 (diff)
downloadzig-75d142c3c78ef786801dcf85f44d16a6530f02d2.tar.gz
zig-75d142c3c78ef786801dcf85f44d16a6530f02d2.zip
llvm8: fix ZigLLVMCreateFunction
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 983bc923dc..83efc1971f 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -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);