Commit Graph
3 Commits
Author SHA1 Message Date
Richard Smith 5b884ae14d Improve lowering for global variables. (#5492)
- Track the `VarPattern` instruction on the `VarStorage` instruction so
that it's available for name mangling.
- Mangle global variables based on the first binding name within their
pattern.
- Give global variables external rather than internal linkage, except if
they have no bindings whatsoever in their pattern.
- To support lowering references to bindings nested within a global var,
such as for `var (x: i32, b: i32)`, add some basic initial support for
reference constant expressions. Treat a global `var` as a reference
constant, and treat an aggregate access into a reference constant as a
reference constant.
2025-05-21 00:09:10 +00:00
Boaz Brickner 04d2643fd7 Reformat banner comments in toolchain/check/testdata/interop/cpp/function_param_*.carbon , following the agreed format in #5467 (#5498)
I've decided to keep `int` and similar as low case, as it refers to an
actual type.

Part of #5436
2025-05-19 21:17:23 +00:00
Boaz Brickner 2b48033da7 Refactor toolchain/check/testdata/interop/cpp/function_decl.carbon (#5457)
* Split to 4 files: `function_param_int16`, `function_param_int32`,
`function_param_unsupported.carbon`, `function_return`.
* Add // === headlines on group of file shards.
* Rename shard files to shorten them and make them more consistent given
the file context.
* Deduplicate identical .h files and group their tests.

Potential future improvements:
* Split further. For example, pointers and references might be somewhat
separate from int primitives.
* Remove `import_` shard file prefix, as it repeats itself, but leaving
for now as it makes it more explicit.

Part of #5263
2025-05-14 16:00:27 +00:00