Commit Graph

8 Commits

Author SHA1 Message Date
Slava Pestov
2e635e9603 Sema: Add @_hasInitialValue and @_hasStorage in typeCheckDecl() not validateDecl()
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.
2019-01-02 15:12:02 -05:00
Harlan Haskins
a1c23be91a [ParseableInterface] Standardize printing for accessors
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.
2018-11-26 18:40:37 -08:00
Harlan Haskins
66a61c5eca Rename @sil_stored to @_hasStorage 2018-11-12 11:32:32 -08:00
Huon Wilson
7753383223 [AST] Add @_hasInitialValue to var/lets that have initializers.
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.
2018-08-07 09:54:35 +10:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Dmitri Hrybenko
1eea220932 Use one module cache directory for all the lit tests to speed them up
Doing so is safe even though we have mock SDK.  The include paths for
modules with the same name in the real and mock SDKs are different, and
the module files will be distinct (because they will have a different
hash).

This reduces test runtime on OS X by 30% and brings it under a minute on
a 16-core machine.

This also uncovered some problems with some tests -- even when run for
iOS configurations, some tests would still run with macosx triple.  I
fixed the tests where I noticed this issue.

rdar://problem/19125022

Swift SVN r23683
2014-12-04 11:21:48 +00:00
Manman Ren
19e595dbe8 [SILParser] enable sil_stored for structs.
Swift SVN r22589
2014-10-08 00:37:37 +00:00
Manman Ren
b697fe1364 [SILParser] fix parsing issues for stored_with_trivial_accessors.
Before this commit, we were not able to differentiate between stored
property and stored_with_trivial_accessors property. This causes issues
when parsing a SILDeclRef to a trivial getter.

We add @sil_stored for stored properties and we will have 3 cases
A) for stored property: @sil_storage var x : Int
B) for stored_with_trivial_accessors property:
   @sil_storage var x : Int { get set }
C) for computed property: var x : Int { get set }

Fix rdar://17715778 rdar://17381432 rdar://17347296.


Swift SVN r20189
2014-07-18 23:18:14 +00:00