]> granicus.if.org Git - clang/commitdiff
Refine ObjCPropertyImplDecl:
authorTed Kremenek <kremenek@apple.com>
Fri, 25 Jul 2008 20:43:38 +0000 (20:43 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 25 Jul 2008 20:43:38 +0000 (20:43 +0000)
- 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

include/clang/AST/DeclObjC.h

index 3128f5b16a62697bee0b6f33d76efa5986d02439..451dc71097abf1c54e17d5601c37187e2b80ee0a 100644 (file)
@@ -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;