aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-02 15:30:04 +0000
committergingerBill <bill@gingerbill.org>2023-01-02 15:30:04 +0000
commit529383f5b17d74f66bebb8679820a69476635b6a (patch)
tree67754a8f0458378fb67888912e6cf956956aa01a /src/llvm_backend_stmt.cpp
parentf01cff7ff0d61a4bd222be159243775b5d9bf3e7 (diff)
Correct a race condition when checking the procedure body
Diffstat (limited to 'src/llvm_backend_stmt.cpp')
-rw-r--r--src/llvm_backend_stmt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp
index 6400a8a9d..cdfb28aa7 100644
--- a/src/llvm_backend_stmt.cpp
+++ b/src/llvm_backend_stmt.cpp
@@ -1531,6 +1531,9 @@ gb_internal void lb_build_static_variables(lbProcedure *p, AstValueDecl *vd) {
lbValue global_val = {global, alloc_type_pointer(e->type)};
lb_add_entity(p->module, e, global_val);
lb_add_member(p->module, mangled_name, global_val);
+ if (e) {
+ map_set(&p->local_entity_map, e, global_val);
+ }
}
}
gb_internal void lb_append_tuple_values(lbProcedure *p, Array<lbValue> *dst_values, lbValue src_value) {
@@ -2188,9 +2191,10 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
for_array(i, vd->names) {
Ast *name = vd->names[i];
if (!is_blank_ident(name)) {
+ GB_ASSERT(name->kind == Ast_Ident);
Entity *e = entity_of_node(name);
TokenPos pos = ast_token(name).pos;
- GB_ASSERT_MSG(e != nullptr, "%s", token_pos_to_string(pos));
+ GB_ASSERT_MSG(e != nullptr, "\n%s missing entity for %.*s", token_pos_to_string(pos), LIT(name->Ident.token.string));
if (e->flags & EntityFlag_Static) {
// NOTE(bill): If one of the entities is static, they all are
is_static = true;