]> granicus.if.org Git - clang/commitdiff
Adds synthesize ivars to DeclContext.
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 6 Jun 2009 16:36:41 +0000 (16:36 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 6 Jun 2009 16:36:41 +0000 (16:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73000 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp
lib/Sema/SemaDeclObjC.cpp

index 21aefdd567bc380c1ca65c88039131e47525061c..60a96d0471abce31c0ae7c08cb884238ef1dc569 100644 (file)
@@ -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;
index 2500a8f7755182d12269a5ff185984f3688088bf..5d475163cb3a68b5823984405e75344722d513f1 100644 (file)
@@ -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;