# Zcu: rework exports · gitcafe/zig

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

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

Visibility: public

Requested revision: 7e552dc1e9a8388f71cc32083deb9dd848e79808

Requested commit: 7e552dc1e9a8388f71cc32083deb9dd848e79808

Commit: 7e552dc1e9a8388f71cc32083deb9dd848e79808

Tree: b1c1086002c91be0e6c1195cc18966906a171ce3

Author: mlugg

Committer: mlugg

## Message

```
Zcu: rework exports

This commit reworks our representation of exported Decls and values in
Zcu to be memory-optimized and trivially serialized.

All exports are now stored in the `all_exports` array on `Zcu`. An
`AnalUnit` which performs an export (either through an `export`
annotation or by containing an analyzed `@export`) gains an entry into
`single_exports` if it performs only one export, or `multi_exports` if
it performs multiple.

We no longer store a persistent mapping from a `Decl`/value to all
exports of that entity; this state is not necessary for the majority of
the pipeline. Instead, we construct it in `Zcu.processExports`, just
before flush. This does not affect the algorithmic complexity of
`processExports`, since this function already iterates all exports in
the `Zcu`.

The elimination of `decl_exports` and `value_exports` led to a few
non-trivial backend changes. The LLVM backend has been wrangled into a
more reasonable state in general regarding exports and externs. The C
backend is currently disabled in this commit, because its support for
`export` was quite broken, and that was exposed by this work -- I'm
hoping @jacobly0 will be able to pick this up!

```

## Parents

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

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