Fix race condition from add_entity_use due to Entity.identifier

This commit is contained in:
gingerBill
2021-08-19 17:38:18 +01:00
parent e722af7f61
commit 38841dd46e
6 changed files with 17 additions and 15 deletions

View File

@@ -1297,9 +1297,9 @@ void add_entity_use(CheckerContext *c, Ast *identifier, Entity *entity) {
if (identifier->kind != Ast_Ident) {
return;
}
if (entity->identifier == nullptr) {
entity->identifier = identifier;
}
Ast *empty_ident = nullptr;
entity->identifier.compare_exchange_strong(empty_ident, identifier);
identifier->Ident.entity = entity;
if (c->info->allow_identifier_uses) {