aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-13 01:56:28 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-13 01:56:28 -0500
commitd4f2394dcf8e5fc9e5be26c3022f8ce435b722a8 (patch)
tree3e81d18b3b8394cd7539dd0a91a8af10dfc07950 /src/codegen.cpp
parenta5c9da0de2d0e2bace3127ba47bd43f5333724c4 (diff)
downloadzig-d4f2394dcf8e5fc9e5be26c3022f8ce435b722a8.tar.gz
zig-d4f2394dcf8e5fc9e5be26c3022f8ce435b722a8.zip
IR handles global variables correctly
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 5fcaac8287..22e9720abb 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -2212,7 +2212,7 @@ static void do_code_gen(CodeGen *g) {
if (!type_has_bits(var->type)) {
continue;
}
- if (var->ref_count == 0)
+ if (var->is_inline)
continue;
if (var->block_context->node->type == NodeTypeFnDef) {
@@ -2257,6 +2257,7 @@ static void do_code_gen(CodeGen *g) {
VariableTableEntry *variable = param_decl->data.param_decl.variable;
assert(variable);
+ assert(variable->value_ref);
if (!handle_is_ptr(variable->type)) {
clear_debug_source_node(g);
@@ -3015,8 +3016,8 @@ void codegen_add_root_code(CodeGen *g, Buf *src_dir, Buf *src_basename, Buf *sou
}
if (g->verbose) {
- fprintf(stderr, "\nSemantic Analysis:\n");
- fprintf(stderr, "--------------------\n");
+ fprintf(stderr, "\nIR Generation and Semantic Analysis:\n");
+ fprintf(stderr, "--------------------------------------\n");
}
if (!g->error_during_imports) {
semantic_analyze(g);