We only ever use this in TBDGen and interface printing, and we only ever
generate TBD files or print interfaces for declarations in primary files,
so let's avoid unnecessary work in validateDecl().
Eventually we want validateDecl() to be replaced with a getInterfaceType()
request, so adding new attributes in this path (or other side effects in
general) is a big no-no.
We want to make sure we are consistent when printing accessors.
@jrose-apple and I landed on the following table for disambiguating all
the possible combinations of accessors:
\### Computed Properties
| Semantics | Syntax |
|------------|------------------------|
| Read-only | var x: T { get } |
| Read-write | var x: T { get set } |
\### Stored Properties
| Semantics | Syntax |
|--------------------------|-------------------------------------|
| Immutable | let x: T |
| Mutable (trivial setter) | var x: T |
| Mutable (custom setter) | @_hasStorage var x: T { get set } |
| Private(set) | @_hasStorage var x: T { get } |
This first commit enables printing @_hasStorage outside of SIL mode.
The information about whether a variable/property is initialized is lost in the
public interface, but is, unfortunately, required because it results in a symbol
for the initializer (if a class/struct `init` is inlined, it will call
initializers for properties that it doesn't initialize itself). This is
important to preserve for TBD file generation.
Using an attribute rather than just a bit on the VarDecl means this fits into
the scheme for module interfaces: textual/valid Swift.