From: Ted Kremenek Date: Fri, 25 Jul 2008 20:43:38 +0000 (+0000) Subject: Refine ObjCPropertyImplDecl: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be57c3a3fef0776fca57ad88b2db263f37b074c4;p=clang Refine ObjCPropertyImplDecl: - Remove a bunch of setXXX methods until we actually need them. This cleans up the interface, and makes the object immutable until we have a reason to be mutable. - Remove enum value OBJC_PR_IMPL_None since it was never used. - Remove instance variable 'PropertyImplKind PropertyImplementation;'. This is not needed because we can tell if ObjCPropertyImplDecl represents @synthesize if 'ObjCPropertyDecl *PropertyDecl' is not null. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54055 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 3128f5b16a..451dc71097 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -1217,7 +1217,6 @@ public: class ObjCPropertyImplDecl : public Decl { public: enum PropertyImplKind { - OBJC_PR_IMPL_None, OBJC_PR_IMPL_SYNTHSIZE, OBJC_PR_IMPL_DYNAMIC }; @@ -1225,16 +1224,19 @@ private: SourceLocation AtLoc; // location of @synthesize or @dynamic /// Property declaration being implemented ObjCPropertyDecl *PropertyDecl; - PropertyImplKind PropertyImplementation; + /// Null for @dynamic. Required for @synthesize. ObjCIvarDecl *PropertyIvarDecl; + public: ObjCPropertyImplDecl(SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, PropertyImplKind propertyKind, ObjCIvarDecl *ivarDecl) : Decl(ObjCPropertyImpl, L), AtLoc(atLoc), PropertyDecl(property), - PropertyImplementation(propertyKind), PropertyIvarDecl(ivarDecl){} + PropertyIvarDecl(ivarDecl) { + assert (propertyKind == OBJC_PR_IMPL_DYNAMIC || PropertyIvarDecl); + } static ObjCPropertyImplDecl *Create(ASTContext &C, SourceLocation atLoc, SourceLocation L, @@ -1242,17 +1244,17 @@ public: PropertyImplKind propertyKind, ObjCIvarDecl *ivarDecl); - void setPropertyDecl(ObjCPropertyDecl *property) { PropertyDecl = property; } - ObjCPropertyDecl *getPropertyDecl() const { return PropertyDecl; } + ObjCPropertyDecl *getPropertyDecl() const { + return PropertyDecl; + } - void setImplKind (PropertyImplKind propImplKind) - { PropertyImplementation = propImplKind; } - PropertyImplKind getPropertyImplementation() const - { return PropertyImplementation; } + PropertyImplKind getPropertyImplementation() const { + return PropertyDecl ? OBJC_PR_IMPL_SYNTHSIZE : OBJC_PR_IMPL_DYNAMIC; + } - void setPropertyIvarDecl(ObjCIvarDecl *ivarDecl) - { PropertyIvarDecl = ivarDecl; } - ObjCIvarDecl *getPropertyIvarDecl() { return PropertyIvarDecl; } + ObjCIvarDecl *getPropertyIvarDecl() { + return PropertyIvarDecl; + } static bool classof(const Decl *D) { return D->getKind() == ObjCPropertyImpl;