[Macros] When a macro defines a getter or setter, remove didSet/willSet

As with the initial value of a property that is converted from a stored
property to a computed property by an accessor macro, remove
didSet/willSet. It is the macro's responsibility to incorporate their
code or diagnose them.

Fixes rdar://111101833.
This commit is contained in:
Doug Gregor
2023-07-05 19:37:21 -07:00
parent 82239e9d0a
commit 16bfd783f4
6 changed files with 117 additions and 50 deletions

View File

@@ -5238,6 +5238,8 @@ private:
void addOpaqueAccessor(AccessorDecl *accessor);
void removeAccessor(AccessorDecl *accessor);
private:
MutableArrayRef<AccessorDecl *> getAccessorsBuffer() {
return { getTrailingObjects<AccessorDecl*>(), NumAccessors };
@@ -5401,6 +5403,11 @@ public:
return {};
}
void removeAccessor(AccessorDecl *accessor) {
if (auto *info = Accessors.getPointer())
return info->removeAccessor(accessor);
}
/// This is the primary mechanism by which we can easily determine whether
/// this storage decl has any effects.
///
@@ -8906,6 +8913,9 @@ const ParamDecl *getParameterAt(const ValueDecl *source, unsigned index);
/// nullptr if the source does not have a parameter list.
const ParamDecl *getParameterAt(const DeclContext *source, unsigned index);
StringRef getAccessorNameForDiagnostic(AccessorDecl *accessor, bool article);
StringRef getAccessorNameForDiagnostic(AccessorKind accessorKind, bool article);
void simple_display(llvm::raw_ostream &out,
OptionSet<NominalTypeDecl::LookupDirectFlags> options);