diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-19 18:02:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-19 18:02:47 +0000 |
commit | e6f07f538fd0eddd6c087fcc01d4e4ff19129c71 (patch) | |
tree | d48b4f4bd3d46b513a2ad7613d7146ece6e97952 /lib/Sema/SemaObjCProperty.cpp | |
parent | 3dbf2f5f00cfc8b25318c119c0d39f4a49d15ebe (diff) |
Revers r138040. Need to look at a few buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index a98c2c7d9a..9602c2bd5b 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -74,6 +74,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, + Decl *ClassCategory, bool *isOverridingProperty, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC) { @@ -100,11 +101,12 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, !(Attributes & ObjCDeclSpec::DQ_PR_weak))); // Proceed with constructing the ObjCPropertDecls. - ObjCContainerDecl *ClassDecl = cast<ObjCContainerDecl>(CurContext); + ObjCContainerDecl *ClassDecl = + cast<ObjCContainerDecl>(ClassCategory); if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl)) if (CDecl->IsClassExtension()) { - Decl *Res = HandlePropertyInClassExtension(S, AtLoc, + Decl *Res = HandlePropertyInClassExtension(S, CDecl, AtLoc, FD, GetterSel, SetterSel, isAssign, isReadWrite, Attributes, @@ -135,7 +137,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, } Decl * -Sema::HandlePropertyInClassExtension(Scope *S, +Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl, SourceLocation AtLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, const bool isAssign, @@ -144,9 +146,9 @@ Sema::HandlePropertyInClassExtension(Scope *S, bool *isOverridingProperty, TypeSourceInfo *T, tok::ObjCKeywordKind MethodImplKind) { - ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(CurContext); + // Diagnose if this property is already in continuation class. - DeclContext *DC = CurContext; + DeclContext *DC = cast<DeclContext>(CDecl); IdentifierInfo *PropertyId = FD.D.getIdentifier(); ObjCInterfaceDecl *CCPrimary = CDecl->getClassInterface(); @@ -233,20 +235,14 @@ Sema::HandlePropertyInClassExtension(Scope *S, ProtocolPropertyODS. setPropertyAttributes((ObjCDeclSpec::ObjCPropertyAttributeKind) PIkind); - // Must re-establish the context from class extension to primary - // class context. - ActOnObjCContainerFinishDefinition(CDecl); - ActOnObjCContainerStartDefinition(CCPrimary); + Decl *ProtocolPtrTy = ActOnProperty(S, AtLoc, FD, ProtocolPropertyODS, PIDecl->getGetterName(), PIDecl->getSetterName(), - isOverridingProperty, + CCPrimary, isOverridingProperty, MethodImplKind, /* lexicalDC = */ CDecl); - // restore class extension context. - ActOnObjCContainerFinishDefinition(CCPrimary); - ActOnObjCContainerStartDefinition(CDecl); PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy); } PIDecl->makeitReadWriteAttribute(); @@ -511,11 +507,12 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool Synthesize, + Decl *ClassCatImpDecl, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc) { ObjCContainerDecl *ClassImpDecl = - cast_or_null<ObjCContainerDecl>(CurContext); + cast_or_null<ObjCContainerDecl>(ClassCatImpDecl); // Make sure we have a context for the property implementation declaration. if (!ClassImpDecl) { Diag(AtLoc, diag::error_missing_property_context); @@ -1283,7 +1280,7 @@ void Sema::DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl, // Saying that they are located at the @implementation isn't really going // to help users. ActOnPropertyImplDecl(S, SourceLocation(), SourceLocation(), - true, + true,IMPDecl, Prop->getIdentifier(), Prop->getIdentifier(), SourceLocation()); } |