Merge pull request #17404 from jckarter/trivial-property-descriptors

SILGen: Emit "trivial" property descriptors for properties that withhold no information about their implementation.
This commit is contained in:
Joe Groff
2018-06-21 20:33:36 -07:00
committed by GitHub
20 changed files with 301 additions and 101 deletions

View File

@@ -1414,7 +1414,8 @@ ValueDecl::getAccessSemanticsFromContext(const DeclContext *UseDC,
AccessStrategy
AbstractStorageDecl::getAccessStrategy(AccessSemantics semantics,
AccessKind accessKind) const {
AccessKind accessKind,
DeclContext *accessFromDC) const {
switch (semantics) {
case AccessSemantics::DirectToStorage:
switch (getStorageKind()) {
@@ -1481,7 +1482,14 @@ AbstractStorageDecl::getAccessStrategy(AccessSemantics semantics,
// This is done by using DirectToStorage semantics above, with the
// understanding that the access semantics are with respect to the
// resilience domain of the accessor's caller.
if (isResilient())
bool resilient;
if (accessFromDC)
resilient = isResilient(accessFromDC->getParentModule(),
ResilienceExpansion::Maximal);
else
resilient = isResilient();
if (resilient)
return AccessStrategy::DirectToAccessor;
if (storageKind == StoredWithObservers ||