From 04535b291310ff53c19fdc96817f2a651b540907 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 26 Apr 2021 22:36:20 +0100 Subject: [PATCH] Fix constant aliasing for debug information --- src/check_decl.cpp | 2 +- src/llvm_backend.cpp | 8 ++++++-- src/parser.cpp | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 218dce2ee..f008317ad 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -359,7 +359,7 @@ void override_entity_in_scope(Entity *original_entity, Entity *new_entity) { } if (original_entity->identifier != nullptr && original_entity->identifier->kind == Ast_Ident) { - original_entity->identifier->Ident.entity = new_entity; + original_entity->identifier->Ident.entity = nullptr; } original_entity->flags |= EntityFlag_Overridden; diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 0fd778b9c..758f8e5d1 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -3544,7 +3544,9 @@ void lb_build_constant_value_decl(lbProcedure *p, AstValueDecl *vd) { Ast *ident = vd->names[i]; GB_ASSERT(ident->kind == Ast_Ident); Entity *e = entity_of_node(ident); - GB_ASSERT(e != nullptr); + if (e == nullptr) { + continue; + } if (e->kind != Entity_TypeName) { continue; } @@ -3573,7 +3575,9 @@ void lb_build_constant_value_decl(lbProcedure *p, AstValueDecl *vd) { Ast *ident = vd->names[i]; GB_ASSERT(ident->kind == Ast_Ident); Entity *e = entity_of_node(ident); - GB_ASSERT(e != nullptr); + if (e == nullptr) { + continue; + } if (e->kind != Entity_Procedure) { continue; } diff --git a/src/parser.cpp b/src/parser.cpp index aff7c6bc7..c81827aa3 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1502,6 +1502,10 @@ bool is_semicolon_optional_for_node(AstFile *f, Ast *s) { return false; } + if (build_context.insert_semicolon) { + return true; + } + switch (s->kind) { case Ast_EmptyStmt: case Ast_BlockStmt: