From 15dbc99cb975675b89f5efe714d5209bce972014 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 4 Mar 2021 16:45:30 +0000 Subject: Minimize TokenPos size by using `i32` for line/column/offset and file_id instead of `String` To make `i32` safe, the parser limits the file size of odin files to a maximum of 2GiB (which will be good enough for the vast vast majority of cases) --- src/query_data.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/query_data.cpp') diff --git a/src/query_data.cpp b/src/query_data.cpp index 24cca6bbd..6c9637948 100644 --- a/src/query_data.cpp +++ b/src/query_data.cpp @@ -553,7 +553,7 @@ void generate_and_print_query_data_global_definitions(Checker *c, Timings *timin def->add("package", e->pkg->name); def->add("name", name); - def->add("filepath", e->token.pos.file); + def->add("filepath", get_file_path_string(e->token.pos.file_id)); def->add("line", cast(i64)e->token.pos.line); def->add("column", cast(i64)e->token.pos.column); def->add("file_offset", cast(i64)e->token.pos.offset); @@ -915,7 +915,7 @@ void generate_and_print_query_data_go_to_definitions(Checker *c) { } - AstFile **use_file_found = string_map_get(&c->info.files, pos.file); + AstFile **use_file_found = string_map_get(&c->info.files, get_file_path_string(pos.file_id)); GB_ASSERT(use_file_found != nullptr); AstFile *use_file = *use_file_found; GB_ASSERT(use_file != nullptr); @@ -1005,7 +1005,7 @@ void generate_and_print_query_data_go_to_definitions(Checker *c) { AstFile *def_file = e->file; if (def_file == nullptr) { - auto *def_file_found = string_map_get(&c->info.files, e->token.pos.file); + auto *def_file_found = string_map_get(&c->info.files, get_file_path_string(e->token.pos.file_id)); if (def_file_found == nullptr) { continue; } -- cgit v1.2.3