aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/DeclObjC.cpp10
-rw-r--r--lib/Sema/SemaDeclObjC.cpp7
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;