[cfe-commits] r73000 - in /cfe/trunk/lib: AST/DeclObjC.cpp Sema/SemaDeclObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Sat Jun 6 09:36:42 PDT 2009


Author: fjahanian
Date: Sat Jun  6 11:36:41 2009
New Revision: 73000

URL: http://llvm.org/viewvc/llvm-project?rev=73000&view=rev
Log:
Adds synthesize ivars to DeclContext.


Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=73000&r1=72999&r2=73000&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat Jun  6 11:36:41 2009
@@ -156,16 +156,6 @@
       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;

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=73000&r1=72999&r2=73000&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sat Jun  6 11:36:41 2009
@@ -1996,10 +1996,15 @@
     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;





More information about the cfe-commits mailing list