From 20eb749ad6983d74ce8285a725d84248d41fca00 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 4 Sep 2016 22:32:23 -0700 Subject: generate debug info for global constants See #41 --- src/analyze.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 5ffce5bdb8..e1728448e3 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -3757,6 +3757,7 @@ static VariableTableEntry *add_local_var(CodeGen *g, AstNode *source_node, Impor VariableTableEntry *variable_entry = allocate(1); variable_entry->type = type_entry; variable_entry->block_context = context; + variable_entry->import = import; if (name) { buf_init_from_buf(&variable_entry->name, name); -- cgit v1.2.3 From 4979e606c36fdca886f82b0dd8c0db17374ab8f6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 5 Sep 2016 16:18:49 -0400 Subject: fix gcc 5.4.0compile errors --- src/analyze.cpp | 2 +- src/codegen.cpp | 4 ++-- src/parseh.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index e1728448e3..3064ad359d 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -6026,7 +6026,7 @@ static TypeTableEntry *analyze_switch_expr(CodeGen *g, ImportTableEntry *import, int *field_use_counts = nullptr; - HashMap err_use_nodes; + HashMap err_use_nodes = {}; if (expr_type->id == TypeTableEntryIdEnum) { field_use_counts = allocate(expr_type->data.enumeration.field_count); } else if (expr_type->id == TypeTableEntryIdErrorUnion) { diff --git a/src/codegen.cpp b/src/codegen.cpp index 6b748634f1..9b0e61fdaf 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2757,7 +2757,7 @@ static LLVMValueRef gen_if_var_expr(CodeGen *g, AstNode *node) { static LLVMValueRef gen_block(CodeGen *g, AstNode *block_node, TypeTableEntry *implicit_return_type) { assert(block_node->type == NodeTypeBlock); - LLVMValueRef return_value; + LLVMValueRef return_value = nullptr; for (int i = 0; i < block_node->data.block.statements.length; i += 1) { AstNode *statement_node = block_node->data.block.statements.at(i); return_value = gen_expr(g, statement_node); @@ -3301,7 +3301,7 @@ static LLVMValueRef gen_var_decl_expr(CodeGen *g, AstNode *node) { } } - LLVMValueRef init_val; + LLVMValueRef init_val = nullptr; TypeTableEntry *init_val_type; return gen_var_decl_raw(g, node, &node->data.variable_declaration, false, &init_val, &init_val_type, false); } diff --git a/src/parseh.cpp b/src/parseh.cpp index fb2605a0e6..64838bb496 100644 --- a/src/parseh.cpp +++ b/src/parseh.cpp @@ -1205,7 +1205,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { emit_warning(c, var_decl, "ignoring variable '%s' - unable to evaluate initializer\n", buf_ptr(name)); return; } - AstNode *init_node; + AstNode *init_node = nullptr; switch (ap_value->getKind()) { case APValue::Int: { -- cgit v1.2.3