Sema: Use a request to create lazy property backing storage

This commit is contained in:
Slava Pestov
2019-06-19 16:30:17 -04:00
parent 9ff34e82b0
commit 1e1e812768
9 changed files with 117 additions and 27 deletions

View File

@@ -2692,6 +2692,8 @@ public:
DeclContextID contextID;
bool isImplicit, isObjC, isStatic, hasNonPatternBindingInit;
bool isGetterMutating, isSetterMutating;
bool isLazyStorageProperty;
DeclID lazyStorageID;
unsigned rawSpecifier, numAccessors, numBackingProperties;
uint8_t readImpl, writeImpl, readWriteImpl, opaqueReadOwnership;
uint8_t rawAccessLevel, rawSetterAccessLevel;
@@ -2704,6 +2706,8 @@ public:
isImplicit, isObjC, isStatic, rawSpecifier,
hasNonPatternBindingInit,
isGetterMutating, isSetterMutating,
isLazyStorageProperty,
lazyStorageID,
opaqueReadOwnership,
readImpl, writeImpl, readWriteImpl,
numAccessors,
@@ -2821,7 +2825,14 @@ public:
cast<OpaqueTypeDecl>(MF.getDecl(opaqueReturnTypeID)));
}
// If there are any backing properties, record the
// If this is a lazy property, record its backing storage.
if (lazyStorageID) {
VarDecl *storage = cast<VarDecl>(MF.getDecl(lazyStorageID));
ctx.evaluator.cacheOutput(
LazyStoragePropertyRequest{var}, std::move(storage));
}
// If there are any backing properties, record them.
if (numBackingProperties > 0) {
VarDecl *backingVar = cast<VarDecl>(MF.getDecl(backingPropertyIDs[0]));
VarDecl *storageWrapperVar = nullptr;