fix debug symbols regression after llvm 3.8.0

This commit is contained in:
Andrew Kelley
2016-04-09 14:21:00 -07:00
parent 7a05e18efb
commit 7026bed462
5 changed files with 23 additions and 9 deletions

View File

@@ -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)) {