aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-09-13 01:30:30 +0100
committergingerBill <bill@gingerbill.org>2021-09-13 01:30:30 +0100
commit042dbda47f8a428c1be2b1af2937f0cbff109c11 (patch)
tree9185639a96d96da650ab290961531036f6ec4e8c /src/parser.cpp
parent2d7aea79b94721362f4fc5285c2a99ab37f52a58 (diff)
Replace many uses of `heap_allocator()` with `permanent_allocator()`
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index e1f21f459..722df0d90 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1196,7 +1196,7 @@ CommentGroup *consume_comment_group(AstFile *f, isize n, isize *end_line_) {
CommentGroup *comments = nullptr;
if (list.count > 0) {
- comments = gb_alloc_item(heap_allocator(), CommentGroup);
+ comments = gb_alloc_item(permanent_allocator(), CommentGroup);
comments->list = slice_from_array(list);
array_add(&f->comments, comments);
}
@@ -4727,8 +4727,6 @@ void destroy_ast_file(AstFile *f) {
array_free(&f->tokens);
array_free(&f->comments);
array_free(&f->imports);
- gb_free(heap_allocator(), f->tokenizer.fullpath.text);
- destroy_tokenizer(&f->tokenizer);
}
bool init_parser(Parser *p) {
@@ -4795,7 +4793,7 @@ WORKER_TASK_PROC(parser_worker_proc) {
void parser_add_file_to_process(Parser *p, AstPackage *pkg, FileInfo fi, TokenPos pos) {
// TODO(bill): Use a better allocator
ImportedFile f = {pkg, fi, pos, p->file_to_process_count++};
- auto wd = gb_alloc_item(heap_allocator(), ParserWorkerData);
+ auto wd = gb_alloc_item(permanent_allocator(), ParserWorkerData);
wd->parser = p;
wd->imported_file = f;
global_thread_pool_add_task(parser_worker_proc, wd);
@@ -4833,7 +4831,7 @@ WORKER_TASK_PROC(foreign_file_worker_proc) {
void parser_add_foreign_file_to_process(Parser *p, AstPackage *pkg, AstForeignFileKind kind, FileInfo fi, TokenPos pos) {
// TODO(bill): Use a better allocator
ImportedFile f = {pkg, fi, pos, p->file_to_process_count++};
- auto wd = gb_alloc_item(heap_allocator(), ForeignFileWorkerData);
+ auto wd = gb_alloc_item(permanent_allocator(), ForeignFileWorkerData);
wd->parser = p;
wd->imported_file = f;
wd->foreign_kind = kind;
@@ -4854,7 +4852,7 @@ AstPackage *try_add_import_path(Parser *p, String const &path, String const &rel
string_set_add(&p->imported_files, path);
- AstPackage *pkg = gb_alloc_item(heap_allocator(), AstPackage);
+ AstPackage *pkg = gb_alloc_item(permanent_allocator(), AstPackage);
pkg->kind = kind;
pkg->fullpath = path;
array_init(&pkg->files, heap_allocator());