[cfe-commits] r69200 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/synthesize-setter-contclass.m

Fariborz Jahanian fjahanian at apple.com
Wed Apr 15 12:19:03 PDT 2009


Author: fjahanian
Date: Wed Apr 15 14:19:03 2009
New Revision: 69200

URL: http://llvm.org/viewvc/llvm-project?rev=69200&view=rev
Log:
Patch to remove a bogus warning which pointed to underlying AST
gen. issue for property in continuation class declared readwrite 
but which did not generate the declaration for the setter. Fix also
removed a FIXME and resulted in code cleanup.

Added:
    cfe/trunk/test/SemaObjC/synthesize-setter-contclass.m
Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=69200&r1=69199&r2=69200&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Apr 15 14:19:03 2009
@@ -1672,24 +1672,14 @@
             if (Attributes & ObjCDeclSpec::DQ_PR_copy)
               PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
             PIDecl->setSetterName(SetterSel);
-            // FIXME: use a common routine with addPropertyMethods.
-            ObjCMethodDecl *SetterDecl =
-              ObjCMethodDecl::Create(Context, AtLoc, AtLoc, SetterSel,
-                                     Context.VoidTy,
-                                     CCPrimary,
-                                     true, false, true, 
-                                     ObjCMethodDecl::Required);
-            ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterDecl,
-                                                        FD.D.getIdentifierLoc(),
-                                                        PropertyId,
-                                                        T, VarDecl::None, 0);
-            SetterDecl->setMethodParams(&Argument, 1, Context);
-            PIDecl->setSetterMethodDecl(SetterDecl);
           }
           else
             Diag(AtLoc, diag::err_use_continuation_class) 
               << CCPrimary->getDeclName();
           *isOverridingProperty = true;
+          // Make sure setter decl is synthesized, and added to primary 
+          // class's list.
+          ProcessPropertyDecl(PIDecl, CCPrimary);
           return DeclPtrTy();
         }
         // No matching property found in the primary class. Just fall thru

Added: cfe/trunk/test/SemaObjC/synthesize-setter-contclass.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/synthesize-setter-contclass.m?rev=69200&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/synthesize-setter-contclass.m (added)
+++ cfe/trunk/test/SemaObjC/synthesize-setter-contclass.m Wed Apr 15 14:19:03 2009
@@ -0,0 +1,24 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+
+ at interface TestClass 
+{
+ int _isItIsOrIsItAint;
+}
+ at property (readonly) int itIsOrItAint;
+-(void) doSomething;
+ at end
+
+ at interface TestClass()
+ at property (readwrite) int itIsOrItAint;
+ at end
+
+ at implementation TestClass
+ at synthesize itIsOrItAint = _isItIsOrIsItAint;
+
+-(void) doSomething
+{
+  int i = [self itIsOrItAint];
+
+ [self setItIsOrItAint:(int)1];
+}
+ at end





More information about the cfe-commits mailing list