]> granicus.if.org Git - clang/commitdiff
Patch to remove a bogus warning which pointed to underlying AST
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 15 Apr 2009 19:19:03 +0000 (19:19 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 15 Apr 2009 19:19:03 +0000 (19:19 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69200 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/synthesize-setter-contclass.m [new file with mode: 0644]

index 464c78a5df10916df90d9cdfdc55c279da16115c..208562f8f12dc959d26f157e3a335d06f9ed95fc 100644 (file)
@@ -1672,24 +1672,14 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
             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
diff --git a/test/SemaObjC/synthesize-setter-contclass.m b/test/SemaObjC/synthesize-setter-contclass.m
new file mode 100644 (file)
index 0000000..78490c8
--- /dev/null
@@ -0,0 +1,24 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+
+@interface TestClass 
+{
+ int _isItIsOrIsItAint;
+}
+@property (readonly) int itIsOrItAint;
+-(void) doSomething;
+@end
+
+@interface TestClass()
+@property (readwrite) int itIsOrItAint;
+@end
+
+@implementation TestClass
+@synthesize itIsOrItAint = _isItIsOrIsItAint;
+
+-(void) doSomething
+{
+  int i = [self itIsOrItAint];
+
+ [self setItIsOrItAint:(int)1];
+}
+@end