diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-04-15 19:19:03 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-04-15 19:19:03 +0000 |
commit | 50c314cb045fef8d442426deb00b75be6f2a1ce3 (patch) | |
tree | b6eb947481769c7cedbc90ac69e296fb1e143a22 | |
parent | f59c1a6d27ff23fb0ea1f5b94be0e1dc866f68b9 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69200 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 16 | ||||
-rw-r--r-- | test/SemaObjC/synthesize-setter-contclass.m | 24 |
2 files changed, 27 insertions, 13 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 464c78a5df..208562f8f1 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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 index 0000000000..78490c8db0 --- /dev/null +++ b/test/SemaObjC/synthesize-setter-contclass.m @@ -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 |