# stage2: fix Decl garbage collection not marking enough · gitcafe/zig

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

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

Visibility: public

Requested revision: a5c7742ba6fc793608b8bb7ba058e33eccd9cfec

Requested commit: a5c7742ba6fc793608b8bb7ba058e33eccd9cfec

Commit: a5c7742ba6fc793608b8bb7ba058e33eccd9cfec

Tree: 29bf43a0bb915e35244d457514885baca2a5916b

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: fix Decl garbage collection not marking enough

It is the job of codegen backends to mark Decls that are referenced as
alive so that the frontend does not sweep them with the garbage. This
commit unifies the code between the backends with an added method on
Decl.

The implementation is more complete than before, switching on the Decl
val tag and recursing into sub-values.

As a result, two more array tests are passing.

```

## Parents

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

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