[cfe-commits] r54055 - /cfe/trunk/include/clang/AST/DeclObjC.h

Ted Kremenek kremenek at apple.com
Fri Jul 25 13:43:38 PDT 2008


Author: kremenek
Date: Fri Jul 25 15:43:38 2008
New Revision: 54055

URL: http://llvm.org/viewvc/llvm-project?rev=54055&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=54055&r1=54054&r2=54055&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Jul 25 15:43:38 2008
@@ -1217,7 +1217,6 @@
 class ObjCPropertyImplDecl : public Decl {
 public:
   enum PropertyImplKind {
-    OBJC_PR_IMPL_None,
     OBJC_PR_IMPL_SYNTHSIZE,
     OBJC_PR_IMPL_DYNAMIC
   };
@@ -1225,16 +1224,19 @@
   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 @@
                                       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;





More information about the cfe-commits mailing list