diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-06 16:36:41 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-06 16:36:41 +0000 |
commit | 8019a7b55086da1b99dd156567d1f8c7e773d225 (patch) | |
tree | 93529e66fc986adb5d8b775bc07e0e418a38e444 | |
parent | cc6fa88666ca2f287df4a600eb31a4087bab9c13 (diff) |
Adds synthesize ivars to DeclContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73000 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/DeclObjC.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 7 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 21aefdd567..60a96d0471 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -156,16 +156,6 @@ ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable( clsDeclared = ClassDecl; return I; } - // look into properties. - for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(Context), - E = ClassDecl->prop_end(Context); I != E; ++I) { - ObjCPropertyDecl *PDecl = (*I); - if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl()) - if (IV->getIdentifier() == ID) { - clsDeclared = ClassDecl; - return IV; - } - } ClassDecl = ClassDecl->getSuperClass(); } return NULL; diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 2500a8f775..5d475163cb 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1996,10 +1996,15 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, ObjCInterfaceDecl *ClassDeclared; Ivar = IDecl->lookupInstanceVariable(Context, PropertyIvar, ClassDeclared); if (!Ivar) { - Ivar = ObjCIvarDecl::Create(Context, CurContext, PropertyLoc, + DeclContext *EnclosingContext = cast_or_null<DeclContext>(IDecl); + assert(EnclosingContext && + "null DeclContext for synthesized ivar - ActOnPropertyImplDecl"); + Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc, PropertyIvar, PropType, ObjCIvarDecl::Public, (Expr *)0); + Ivar->setLexicalDeclContext(IDecl); + IDecl->addDecl(Context, Ivar); property->setPropertyIvarDecl(Ivar); if (!getLangOptions().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; |