]> granicus.if.org Git - clang/commitdiff
Remove Action::ActOnImpleIvarVsClassIvars(), it is only called by Sema (not Parser).
authorSteve Naroff <snaroff@apple.com>
Tue, 2 Oct 2007 21:43:37 +0000 (21:43 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 2 Oct 2007 21:43:37 +0000 (21:43 +0000)
Add Sema::CheckImplementationIvars() to replace the previous action.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42553 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/Sema.h
Sema/SemaDecl.cpp
include/clang/AST/DeclObjC.h
include/clang/Parse/Action.h

index b1906d3a24940c6339e2b741be105556cf816093..e9dc4d0cb2c41d086ff13dd976522ca651b93617 100644 (file)
@@ -51,6 +51,7 @@ namespace clang {
   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 @@ private:
                                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 @@ public:
   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
index 64789bc3f50ab514326609003939361b9bd18765..1e0198aa853b51faa7ad21e2b3aafd19b715cdb0 100644 (file)
@@ -1168,17 +1168,18 @@ Sema::DeclTy *Sema::ObjcStartClassImplementation(Scope *S,
   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 @@ void Sema::ActOnFields(Scope* S,
        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());
     }
   }
 }
index 4509be09535a35312101db94acaf5868c90bbd2a..b0ff5feb9d664a05e74930c0793e69647bd19475 100644 (file)
@@ -81,7 +81,8 @@ public:
       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];
index 0376860160b414715dac036c11e57690ae2abffd..73580badd8c3cfdfd1adb755162cfd3fc9584c2c 100644 (file)
@@ -448,10 +448,6 @@ public:
                                     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,