From 60a7c68aa6071735e4576795989d1af6f59c28dc Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 25 Feb 2018 14:23:45 +0000 Subject: [PATCH] Minor code reorganization --- src/ir.cpp | 1 + src/main.cpp | 3 +++ src/parser.cpp | 12 +++--------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ir.cpp b/src/ir.cpp index 731044a33..f2229178f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7795,6 +7795,7 @@ bool ir_gen_init(irGen *s, Checker *c) { gbFileError err = gb_file_create(&s->output_file, output_file_path); if (err != gbFileError_None) { + gb_printf_err("Failed to create file %s\n", output_file_path); return false; } diff --git a/src/main.cpp b/src/main.cpp index 46a1b4e70..e6d7012cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -713,6 +713,7 @@ int main(int arg_count, char **arg_ptr) { return 0; } + timings_start_section(&timings, str_lit("type check")); Checker checker = {0}; @@ -728,6 +729,8 @@ int main(int arg_count, char **arg_ptr) { } // defer (ir_gen_destroy(&ir_gen)); + + timings_start_section(&timings, str_lit("llvm ir gen")); ir_gen_tree(&ir_gen); diff --git a/src/parser.cpp b/src/parser.cpp index 1dec8bfdb..763e7fca3 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -4213,6 +4213,7 @@ skip: file->id = imported_file.index; array_add(&p->files, file); p->total_line_count += file->tokenizer.line_count; + p->total_token_count += file->tokens.count; gb_mutex_unlock(&p->file_add_mutex); return ParseFile_None; @@ -4258,7 +4259,6 @@ ParseFileError parse_files(Parser *p, String init_filename) { array_add(&p->imports, init_imported_file); p->init_fullpath = init_fullpath; - // IMPORTANT TODO(bill): Figure out why this doesn't work on *nix sometimes #if USE_THREADED_PARSER && defined(GB_SYSTEM_WINDOWS) isize thread_count = gb_max(build_context.thread_count, 1); @@ -4297,7 +4297,8 @@ ParseFileError parse_files(Parser *p, String init_filename) { if (err != ParseFile_None) { return err; } - t->user_index = curr_import_index++; + t->user_index = curr_import_index; + curr_import_index++; gb_thread_start(t, parse_worker_file_proc, p); are_any_alive = true; } @@ -4306,7 +4307,6 @@ ParseFileError parse_files(Parser *p, String init_filename) { break; } } - } else { for_array(i, p->imports) { ParseFileError err = parse_import(p, p->imports[i]); @@ -4316,7 +4316,6 @@ ParseFileError parse_files(Parser *p, String init_filename) { } } #else - for_array(i, p->imports) { ParseFileError err = parse_import(p, p->imports[i]); if (err != ParseFile_None) { @@ -4325,11 +4324,6 @@ ParseFileError parse_files(Parser *p, String init_filename) { } #endif - for_array(i, p->files) { - p->total_token_count += p->files[i]->tokens.count; - } - - return ParseFile_None; }