diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-10 23:36:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-10 23:36:33 +0000 |
commit | 88f5e9be350f4b107f8665183a6d441874e0fcc7 (patch) | |
tree | e885535987fd1ff73da44d2504a506ff93d01846 /lib/Sema/SemaDeclObjC.cpp | |
parent | 141e489973d1c3f90bfee607e288c56b8dbb5721 (diff) |
Any property declared in a class extension might have user
declared setter or getter in current class extension or one
of the other class extensions. Mark them as synthesized as
property will be synthesized when property with same name is
seen in the @implementation. This prevents bogus warning
about unimplemented methods to be issued for these methods.
Fixes // rdar://8747333
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 57c1922292..a7014f6755 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1522,8 +1522,29 @@ void Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, // Compare protocol properties with those in category CompareProperties(C, C); - if (C->IsClassExtension()) - DiagnoseClassExtensionDupMethods(C, C->getClassInterface()); + if (C->IsClassExtension()) { + ObjCInterfaceDecl *CCPrimary = C->getClassInterface(); + DiagnoseClassExtensionDupMethods(C, CCPrimary); + for (ObjCContainerDecl::prop_iterator I = C->prop_begin(), + E = C->prop_end(); I != E; ++I) { + // Any property declared in a class extension might have user + // declared setter or getter in current class extension or one + // of the other class extensions. Mark them as synthesized as + // property will be synthesized when property with same name is + // seen in the @implementation. + for (const ObjCCategoryDecl *ClsExtDecl = + CCPrimary->getFirstClassExtension(); + ClsExtDecl; ClsExtDecl = ClsExtDecl->getNextClassExtension()) { + if (ObjCMethodDecl *GetterMethod = + ClsExtDecl->getInstanceMethod((*I)->getGetterName())) + GetterMethod->setSynthesized(true); + if (!(*I)->isReadOnly()) + if (ObjCMethodDecl *SetterMethod = + ClsExtDecl->getInstanceMethod((*I)->getSetterName())) + SetterMethod->setSynthesized(true); + } + } + } } if (ObjCContainerDecl *CDecl = dyn_cast<ObjCContainerDecl>(ClassDecl)) { if (CDecl->getIdentifier()) |