aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-04-09 14:21:00 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-04-09 14:21:55 -0700
commit7026bed4625b4fe9ac068b045a17e822791ceb93 (patch)
tree652760a2b18c6f7b2f303074705e333ba4c7d500 /src/codegen.cpp
parent7a05e18efb35330475e7ee6253f9fec6103c560f (diff)
downloadzig-7026bed4625b4fe9ac068b045a17e822791ceb93.tar.gz
zig-7026bed4625b4fe9ac068b045a17e822791ceb93.zip
fix debug symbols regression after llvm 3.8.0
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index c86ce0ed10..588e831af6 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -744,6 +744,7 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
case CastOpBoolToInt:
assert(wanted_type->id == TypeTableEntryIdInt);
assert(actual_type->id == TypeTableEntryIdBool);
+ add_debug_source_node(g, node);
return LLVMBuildZExt(g->builder, expr_val, wanted_type->type_ref, "");
}
@@ -1965,6 +1966,7 @@ static LLVMValueRef gen_if_bool_expr_raw(CodeGen *g, AstNode *source_node, LLVMV
endif_block = LLVMAppendBasicBlock(g->cur_fn->fn_value, "EndIf");
}
+ add_debug_source_node(g, source_node);
LLVMBuildCondBr(g->builder, cond_value, then_block, else_block);
LLVMPositionBuilderAtEnd(g->builder, then_block);
@@ -3836,6 +3838,8 @@ static void init(CodeGen *g, Buf *source_path) {
LLVMSetTarget(g->module, buf_ptr(&g->triple_str));
+ ZigLLVMAddModuleDebugInfoFlag(g->module);
+
LLVMTargetRef target_ref;
char *err_msg = nullptr;
if (LLVMGetTargetFromTriple(buf_ptr(&g->triple_str), &target_ref, &err_msg)) {