Sema: Add request to compute if an AccessorDecl is transparent

Implicit accessors are sometimes transparent for performance reasons.
Previously this was done in Sema by maybeMarkTransparent(), which would
add a TransparentAttr. Replace this with a request.
This commit is contained in:
Slava Pestov
2019-07-26 23:46:34 -04:00
parent 37f0d6a613
commit e41760e44f
12 changed files with 131 additions and 31 deletions

View File

@@ -2984,7 +2984,7 @@ public:
DeclID associatedDeclID;
DeclID overriddenID;
DeclID accessorStorageDeclID;
bool needsNewVTableEntry;
bool needsNewVTableEntry, isTransparent;
DeclID opaqueResultTypeDeclID;
ArrayRef<uint64_t> nameAndDependencyIDs;
@@ -3013,6 +3013,7 @@ public:
rawAccessorKind,
rawAccessLevel,
needsNewVTableEntry,
isTransparent,
nameAndDependencyIDs);
}
@@ -3128,12 +3129,15 @@ public:
/*Throws=*/throws, /*ThrowsLoc=*/SourceLoc(),
genericParams, DC);
} else {
fn = AccessorDecl::createDeserialized(
auto *accessor = AccessorDecl::createDeserialized(
ctx, /*FuncLoc=*/SourceLoc(), /*AccessorKeywordLoc=*/SourceLoc(),
accessorKind, storage,
/*StaticLoc=*/SourceLoc(), staticSpelling.getValue(),
/*Throws=*/throws, /*ThrowsLoc=*/SourceLoc(),
genericParams, DC);
accessor->setIsTransparent(isTransparent);
fn = accessor;
}
fn->setEarlyAttrValidation();
declOrOffset = fn;