# stage2: improve Decl lifetime management · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1ab1a96f87279375e656bba35280a85b62973255)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1ab1a96f87279375e656bba35280a85b62973255

Requested commit: 1ab1a96f87279375e656bba35280a85b62973255

Commit: 1ab1a96f87279375e656bba35280a85b62973255

Tree: 456a1c00ce806827214678f13ef721dfe704a970

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: improve Decl lifetime management

 * Compilation: iteration over the deletion_set only tries to delete the
   first one, relying on Decl destroy to remove itself from the deletion
   set.
 * link: `freeDecl` now has to handle the possibility of freeing a Decl
   that was never called with `allocateDeclIndexes`.
 * `deleteDecl` recursively iterates over a Decl's Namespace sub-Decl
   objects and calls `deleteDecl` on them.
   - Prevents Decl objects from being destroyed when they are still in
     `deletion_set`.
 * Sema: fix cleanup of anonymous Decl objects when an error occurs
   during semantic analysis.
 * tests: update test cases for fully qualified names

```

## Parents

- [d7567c06fd8bc1777f98e33abfe3070f698782ec](https://git.cafe/gitcafe/zig/commit/d7567c06fd8bc1777f98e33abfe3070f698782ec?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1ab1a96f87279375e656bba35280a85b62973255?format=markdown)
