aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-04 22:20:18 +0000
committergingerBill <bill@gingerbill.org>2023-01-04 22:20:18 +0000
commit9455918eec18f3101d040adea09a628f684563f9 (patch)
treea37cd9f0388fda66178991e7c641f99ad76b9a8d /src
parent8a99b8af3e875141156d359026b785fcfd284f57 (diff)
Fix min dep type info problem caused by const ref of `map_set`
Diffstat (limited to 'src')
-rw-r--r--src/check_decl.cpp29
-rw-r--r--src/checker.cpp5
-rw-r--r--src/llvm_backend_type.cpp2
3 files changed, 34 insertions, 2 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 07b547feb..644771dcd 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -1576,5 +1576,34 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
check_scope_usage(ctx->checker, ctx->scope);
+ // if (decl->parent) {
+ // Scope *ps = decl->parent->scope;
+ // if (ps->flags & (ScopeFlag_File & ScopeFlag_Pkg & ScopeFlag_Global)) {
+ // return true;
+ // } else {
+ // // NOTE(bill): Add the dependencies from the procedure literal (lambda)
+ // // But only at the procedure level
+ // rw_mutex_shared_lock(&decl->deps_mutex);
+ // rw_mutex_lock(&decl->parent->deps_mutex);
+
+ // for (Entity *e : decl->deps) {
+ // ptr_set_add(&decl->parent->deps, e);
+ // }
+
+ // rw_mutex_unlock(&decl->parent->deps_mutex);
+ // rw_mutex_shared_unlock(&decl->deps_mutex);
+
+ // rw_mutex_shared_lock(&decl->type_info_deps_mutex);
+ // rw_mutex_lock(&decl->parent->type_info_deps_mutex);
+
+ // for (Type *t : decl->type_info_deps) {
+ // ptr_set_add(&decl->parent->type_info_deps, t);
+ // }
+
+ // rw_mutex_unlock(&decl->parent->type_info_deps_mutex);
+ // rw_mutex_shared_unlock(&decl->type_info_deps_mutex);
+ // }
+ // }
+
return true;
}
diff --git a/src/checker.cpp b/src/checker.cpp
index 0bebce232..8cb6ea99d 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -2030,7 +2030,10 @@ gb_internal void add_min_dep_type_info(Checker *c, Type *t) {
// Type already exists;
return;
}
- map_set(set, ti_index, set->entries.count);
+ // IMPORTANT NOTE(bill): this must be copied as `map_set` takes a const ref
+ // and effectively assigns the `+1` of the value
+ isize const count = set->entries.count;
+ map_set(set, ti_index, count);
// Add nested types
if (t->kind == Type_Named) {
diff --git a/src/llvm_backend_type.cpp b/src/llvm_backend_type.cpp
index b9b450404..e2b5c9dd0 100644
--- a/src/llvm_backend_type.cpp
+++ b/src/llvm_backend_type.cpp
@@ -186,7 +186,7 @@ gb_internal void lb_setup_type_info_data(lbProcedure *p) { // NOTE(bill): Setup
if (entry_index <= 0) {
continue;
}
-
+
if (entries_handled[entry_index]) {
continue;
}