diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-14 22:01:39 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-14 22:06:25 -0700 |
| commit | 52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7 (patch) | |
| tree | 7f08300bbaedd657fc46ae816e0302470becfb1a /src/codegen.cpp | |
| parent | 304941026013e6310c9362849610c32d98d1332a (diff) | |
| download | zig-52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7.tar.gz zig-52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7.zip | |
analyze: BlockContext has concept of module scope
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 47f64541a5..5593a689eb 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1132,8 +1132,8 @@ static void do_code_gen(CodeGen *g) { // Set up debug info for blocks and variables and // allocate all local variables - for (int bc_i = 0; bc_i < codegen_fn_def->all_block_contexts.length; bc_i += 1) { - BlockContext *block_context = codegen_fn_def->all_block_contexts.at(bc_i); + for (int bc_i = 0; bc_i < fn_table_entry->all_block_contexts.length; bc_i += 1) { + BlockContext *block_context = fn_table_entry->all_block_contexts.at(bc_i); if (block_context->parent) { LLVMZigDILexicalBlock *di_block = LLVMZigCreateLexicalBlock(g->dbuilder, @@ -1530,6 +1530,9 @@ static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *src_dirname, Buf *src import_entry->di_file = LLVMZigCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); g->import_table.put(full_path, import_entry); + import_entry->block_context = new_block_context(nullptr, nullptr); + import_entry->block_context->di_scope = LLVMZigFileToScope(import_entry->di_file); + assert(import_entry->root->type == NodeTypeRoot); for (int decl_i = 0; decl_i < import_entry->root->data.root.top_level_decls.length; decl_i += 1) { |
