diff options
-rw-r--r-- | include/clang/AST/ASTContext.h | 2 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 32 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 4 |
3 files changed, 7 insertions, 31 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index cf9aa50af2..71ddc8794b 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -950,8 +950,6 @@ public: llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); void CollectNonClassIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); - void CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD, - llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); unsigned CountSynthesizedIvars(const ObjCInterfaceDecl *OI); unsigned CountProtocolSynthesizedIvars(const ObjCProtocolDecl *PD); void CollectInheritedProtocols(const Decl *CDecl, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 26b10b5871..079c16ac6b 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -971,22 +971,10 @@ void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI, CollectNonClassIvars(OI, Ivars); } -void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD, - llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) { - for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(), - E = PD->prop_end(); I != E; ++I) - if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl()) - Ivars.push_back(Ivar); - - // Also look into nested protocols. - for (ObjCProtocolDecl::protocol_iterator P = PD->protocol_begin(), - E = PD->protocol_end(); P != E; ++P) - CollectProtocolSynthesizedIvars(*P, Ivars); -} - /// CollectNonClassIvars - /// This routine collects all other ivars which are not declared in the class. -/// This includes synthesized ivars and those in class's implementation. +/// This includes synthesized ivars (via @synthesize) and those in +// class's @implementation. /// void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) { @@ -997,21 +985,9 @@ void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI, Ivars.push_back(*I); } } - - for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(), - E = OI->prop_end(); I != E; ++I) { - if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl()) - Ivars.push_back(Ivar); - } - // Also look into interface's protocol list for properties declared - // in the protocol and whose ivars are synthesized. - for (ObjCInterfaceDecl::protocol_iterator P = OI->protocol_begin(), - PE = OI->protocol_end(); P != PE; ++P) { - ObjCProtocolDecl *PD = (*P); - CollectProtocolSynthesizedIvars(PD, Ivars); - } - // Also add any ivar defined in this class's implementation + // Also add any ivar defined in this class's implementation. This + // includes synthesized ivars. if (ObjCImplementationDecl *ImplDecl = OI->getImplementation()) { for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(), E = ImplDecl->ivar_end(); I != E; ++I) diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 762ef38c97..da00951caf 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -2492,15 +2492,17 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, ObjCInterfaceDecl *ClassDeclared; Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared); if (!Ivar) { - DeclContext *EnclosingContext = cast_or_null<DeclContext>(IDecl); + DeclContext *EnclosingContext = cast_or_null<DeclContext>(ClassImpDecl); assert(EnclosingContext && "null DeclContext for synthesized ivar - ActOnPropertyImplDecl"); Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc, PropertyIvar, PropType, /*Dinfo=*/0, ObjCIvarDecl::Public, (Expr *)0); + EnclosingContext->addDecl(Ivar); IDecl->makeDeclVisibleInContext(Ivar, false); property->setPropertyIvarDecl(Ivar); + if (!getLangOptions().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; // Note! I deliberately want it to fall thru so, we have a |