[cfe-commits] r43403 - /cfe/trunk/Sema/SemaDecl.cpp

Fariborz Jahanian fjahanian at apple.com
Fri Oct 26 13:50:30 PDT 2007


Author: fjahanian
Date: Fri Oct 26 15:50:24 2007
New Revision: 43403

URL: http://llvm.org/viewvc/llvm-project?rev=43403&view=rev
Log:
This patch allows synthesis generation of ivar offset for legacy objective-c @implementation 
decl without an @interface decl.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=43403&r1=43402&r2=43403&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Fri Oct 26 15:50:24 2007
@@ -1237,6 +1237,7 @@
     IDecl = new ObjcInterfaceDecl(SourceLocation(), 0, ClassName);
     IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>());
     ClassName->setFETokenInfo(IDecl);
+    IDecl->setSuperClass(SDecl);
     
     // Remember that this needs to be removed when the scope is popped.
     TUScope->AddDecl(IDecl);
@@ -1256,10 +1257,16 @@
                                     ObjcIvarDecl **ivars, unsigned numIvars) {
   assert(ImpDecl && "missing implementation decl");
   ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier());
-  /// 2nd check is added to accomodate case of non-existing @interface decl.
+  if (!IDecl)
+    return;
+  /// Check case of non-existing @interface decl.
   /// (legacy objective-c @implementation decl without an @interface decl).
-  if (!IDecl || IDecl->ImplicitInterfaceDecl())
+  /// Add implementations's ivar to the synthesize class's ivar list.
+  if (IDecl->ImplicitInterfaceDecl()) {
+    IDecl->ObjcAddInstanceVariablesToClass(ivars, numIvars);
     return;
+  }
+  
   assert(ivars && "missing @implementation ivars");
   
   // Check interface's Ivar list against those in the implementation.





More information about the cfe-commits mailing list