mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ABI checker: include all kinds of accessors for abstract storage decl and diagnose their missing.
Removing accessors other than getter and setter can be ABI breaking. This patch starts to formally include all accessor decls in the tree and diagnose their removal. This change only applies to the ABI checker since we still exclude accessors other than getter and setter when diagnosing source compatibility. Including accessors formally can also allow us to check the missing of availability attributes for newly added accessors. rdar://52063421
This commit is contained in:
@@ -169,6 +169,7 @@ public:
|
||||
#include "swift/AST/KnownIdentifiers.def"
|
||||
|
||||
SDKContext(CheckerOptions Options);
|
||||
|
||||
llvm::BumpPtrAllocator &allocator() {
|
||||
return Allocator;
|
||||
}
|
||||
@@ -579,23 +580,22 @@ public:
|
||||
static bool classof(const SDKNode *N);
|
||||
};
|
||||
|
||||
class SDKNodeDeclAccessor;
|
||||
class SDKNodeDeclVar : public SDKNodeDecl {
|
||||
bool IsLet;
|
||||
bool HasStorage;
|
||||
bool HasDidSet;
|
||||
bool HasWillSet;
|
||||
std::vector<SDKNode*> Accessors;
|
||||
public:
|
||||
SDKNodeDeclVar(SDKNodeInitInfo Info);
|
||||
static bool classof(const SDKNode *N);
|
||||
SDKNodeDeclGetter *getGetter() const;
|
||||
SDKNodeDeclSetter *getSetter() const;
|
||||
SDKNodeDeclAccessor *getAccessor(AccessorKind Kind) const;
|
||||
ArrayRef<SDKNode*> getAllAccessors() const { return Accessors; }
|
||||
SDKNodeType *getType() const;
|
||||
bool isLet() const { return IsLet; }
|
||||
void jsonize(json::Output &Out) override;
|
||||
void diagnose(SDKNode *Right) override;
|
||||
bool hasStorage() const { return HasStorage; }
|
||||
bool hasDidSet() const { return HasDidSet; }
|
||||
bool hasWillSet() const { return HasWillSet; }
|
||||
void addAccessor(SDKNode* AC);
|
||||
};
|
||||
|
||||
class SDKNodeDeclAbstractFunc : public SDKNodeDecl {
|
||||
@@ -619,19 +619,16 @@ public:
|
||||
};
|
||||
|
||||
class SDKNodeDeclSubscript: public SDKNodeDeclAbstractFunc {
|
||||
bool HasSetter;
|
||||
bool HasStorage;
|
||||
bool HasDidSet;
|
||||
bool HasWillSet;
|
||||
std::vector<SDKNode*> Accessors;
|
||||
public:
|
||||
SDKNodeDeclSubscript(SDKNodeInitInfo Info);
|
||||
static bool classof(const SDKNode *N);
|
||||
bool hasSetter() const { return HasSetter; }
|
||||
bool hasStorage() const { return HasStorage; }
|
||||
SDKNodeDeclAccessor *getAccessor(AccessorKind Kind) const;
|
||||
ArrayRef<SDKNode*> getAllAccessors() const { return Accessors; }
|
||||
void jsonize(json::Output &Out) override;
|
||||
void diagnose(SDKNode *Right) override;
|
||||
bool hasDidSet() const { return HasDidSet; }
|
||||
bool hasWillSet() const { return HasWillSet; }
|
||||
void addAccessor(SDKNode* AC);
|
||||
};
|
||||
|
||||
class SDKNodeDeclFunction: public SDKNodeDeclAbstractFunc {
|
||||
@@ -651,16 +648,17 @@ public:
|
||||
static bool classof(const SDKNode *N);
|
||||
};
|
||||
|
||||
class SDKNodeDeclGetter: public SDKNodeDeclAbstractFunc {
|
||||
class SDKNodeDeclAccessor: public SDKNodeDeclAbstractFunc {
|
||||
SDKNodeDecl *Owner;
|
||||
AccessorKind AccKind;
|
||||
friend class SDKNodeDeclVar;
|
||||
friend class SDKNodeDeclSubscript;
|
||||
public:
|
||||
SDKNodeDeclGetter(SDKNodeInitInfo Info);
|
||||
static bool classof(const SDKNode *N);
|
||||
};
|
||||
|
||||
class SDKNodeDeclSetter: public SDKNodeDeclAbstractFunc {
|
||||
public:
|
||||
SDKNodeDeclSetter(SDKNodeInitInfo Info);
|
||||
SDKNodeDeclAccessor(SDKNodeInitInfo Info);
|
||||
AccessorKind getAccessorKind() const { return AccKind; }
|
||||
static bool classof(const SDKNode *N);
|
||||
SDKNodeDecl* getStorage() const { return Owner; }
|
||||
void jsonize(json::Output &Out) override;
|
||||
};
|
||||
|
||||
// The additional information we need for a type node in the digest.
|
||||
@@ -753,7 +751,6 @@ int findDeclUsr(StringRef dumpPath, CheckerOptions Opts);
|
||||
|
||||
void nodeSetDifference(ArrayRef<SDKNode*> Left, ArrayRef<SDKNode*> Right,
|
||||
NodeVector &LeftMinusRight, NodeVector &RightMinusLeft);
|
||||
|
||||
} // end of abi namespace
|
||||
} // end of ide namespace
|
||||
} // end of Swift namespace
|
||||
|
||||
Reference in New Issue
Block a user