[cfe-commits] r42553 - in /cfe/trunk: Sema/Sema.h Sema/SemaDecl.cpp include/clang/AST/DeclObjC.h include/clang/Parse/Action.h

Steve Naroff snaroff at apple.com
Tue Oct 2 14:43:37 PDT 2007


Author: snaroff
Date: Tue Oct  2 16:43:37 2007
New Revision: 42553

URL: http://llvm.org/viewvc/llvm-project?rev=42553&view=rev
Log:

Remove Action::ActOnImpleIvarVsClassIvars(), it is only called by Sema (not Parser).
Add Sema::CheckImplementationIvars() to replace the previous action.


Modified:
    cfe/trunk/Sema/Sema.h
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/include/clang/Parse/Action.h

Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=42553&r1=42552&r2=42553&view=diff

==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Tue Oct  2 16:43:37 2007
@@ -51,6 +51,7 @@
   class ObjcImplementationDecl;
   class ObjcCategoryImplDecl;
   class ObjcCategoryDecl;
+  class ObjcIvarDecl;
 
 /// Sema - This implements semantic analysis and AST building for C.
 class Sema : public Action {
@@ -216,6 +217,11 @@
                                const llvm::DenseMap<void *, char>& InsMap,
                                const llvm::DenseMap<void *, char>& ClsMap);
   
+  /// CheckImplementationIvars - This routine checks if the instance variables
+  /// listed in the implelementation match those listed in the interface. 
+  void CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
+                                ObjcIvarDecl **Fields, unsigned nIvars);
+  
   /// ImplMethodsVsClassMethods - This is main routine to warn if any method
   /// remains unimplemented in the @implementation class.
   void ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, 
@@ -421,9 +427,6 @@
   virtual void ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl, 
 				     DeclTy **allMethods, unsigned allNum);
   
-  virtual void ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
-                                          DeclTy **Fields, unsigned NumFields);
-  
   virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc, 
     tok::TokenKind MethodType, TypeTy *ReturnType, Selector Sel,
     // optional arguments. The number of types/arguments is obtained

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

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Oct  2 16:43:37 2007
@@ -1168,17 +1168,18 @@
   return IMPDecl;
 }
 
-void Sema::ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
-                                      DeclTy **Fields, unsigned numIvars) {
-  ObjcInterfaceDecl* IDecl = 
-    cast<ObjcInterfaceDecl>(static_cast<Decl*>(ClassDecl));
-  assert(IDecl && "missing named interface class decl");
-  ObjcIvarDecl** ivars = reinterpret_cast<ObjcIvarDecl**>(Fields);
+void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
+                                    ObjcIvarDecl **ivars, unsigned numIvars) {
+  assert(ImpDecl && "missing implementation decl");
+  ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier());
+  
+  if (!IDecl)
+    return;
   assert(ivars && "missing @implementation ivars");
   
-    // Check interface's Ivar list against those in the implementation.
-    // names and types must match.
-    //
+  // Check interface's Ivar list against those in the implementation.
+  // names and types must match.
+  //
   ObjcIvarDecl** IntfIvars = IDecl->getIntfDeclIvars();
   int IntfNumIvars = IDecl->getIntfDeclNumIvars();
   unsigned j = 0;
@@ -1676,10 +1677,7 @@
 	cast<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl));
       assert(IMPDecl && "ActOnFields - missing ObjcImplementationDecl");
       IMPDecl->ObjcAddInstanceVariablesToClassImpl(ClsFields, RecFields.size());
-      ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(IMPDecl->getIdentifier());
-      if (IDecl)
-        ActOnImpleIvarVsClassIvars(static_cast<DeclTy*>(IDecl), 
-          reinterpret_cast<DeclTy**>(&RecFields[0]), RecFields.size());
+      CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size());
     }
   }
 }

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=42553&r1=42552&r2=42553&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Oct  2 16:43:37 2007
@@ -81,7 +81,8 @@
       ListCategories(0), ForwardDecl(FD) {
         AllocIntfRefProtocols(numRefProtos);
       }
-    
+  
+  // This is necessary when converting a forward declaration to a definition.
   void AllocIntfRefProtocols(unsigned numRefProtos) {
     if (numRefProtos) {
       IntfRefProtocols = new ObjcProtocolDecl*[numRefProtos];

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=42553&r1=42552&r2=42553&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Tue Oct  2 16:43:37 2007
@@ -448,10 +448,6 @@
 				     DeclTy **allMethods, unsigned allNum) {
     return;
   }
-  virtual void ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
-                                          DeclTy **Fields, unsigned NumFields) {
-    return;
-  }
   virtual DeclTy *ObjcStartProtoInterface(Scope* S,
 		    SourceLocation AtProtoInterfaceLoc,
                     IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,





More information about the cfe-commits mailing list