[cfe-commits] r44938 - in /cfe/trunk: Sema/SemaDeclObjC.cpp clang.xcodeproj/project.pbxproj include/clang/AST/DeclObjC.h

Chris Lattner sabre at nondot.org
Wed Dec 12 09:58:05 PST 2007


Author: lattner
Date: Wed Dec 12 11:58:05 2007
New Revision: 44938

URL: http://llvm.org/viewvc/llvm-project?rev=44938&view=rev
Log:
unbreak the build.  I'm still working on test failures.

Modified:
    cfe/trunk/Sema/SemaDeclObjC.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/AST/DeclObjC.h

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

==============================================================================
--- cfe/trunk/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/Sema/SemaDeclObjC.cpp Wed Dec 12 11:58:05 2007
@@ -413,13 +413,13 @@
   // Check interface's Ivar list against those in the implementation.
   // names and types must match.
   //
-  ObjcIvarDecl** IntfIvars = IDecl->getInstanceVariables();
-  int IntfNumIvars = IDecl->getNumInstanceVariables();
   unsigned j = 0;
   bool err = false;
-  while (numIvars > 0 && IntfNumIvars > 0) {
+  ObjcInterfaceDecl::ivar_iterator 
+    IVI = IDecl->ivar_begin(), IVE = IDecl->ivar_end();
+  for (; numIvars > 0 && IVI != IVE; ++IVI) {
     ObjcIvarDecl* ImplIvar = ivars[j];
-    ObjcIvarDecl* ClsIvar = IntfIvars[j++];
+    ObjcIvarDecl* ClsIvar = *IVI;
     assert (ImplIvar && "missing implementation ivar");
     assert (ClsIvar && "missing class ivar");
     if (ImplIvar->getCanonicalType() != ClsIvar->getCanonicalType()) {
@@ -439,10 +439,9 @@
       break;
     }
     --numIvars;
-    --IntfNumIvars;
   }
-  if (!err && (numIvars > 0 || IntfNumIvars > 0))
-    Diag(numIvars > 0 ? ivars[j]->getLocation() : IntfIvars[j]->getLocation(), 
+  if (!err && (numIvars > 0 || IVI != IVE))
+    Diag(numIvars > 0 ? ivars[j]->getLocation() : (*IVI)->getLocation(), 
          diag::err_inconsistant_ivar);
       
 }
@@ -484,30 +483,31 @@
   llvm::DenseSet<Selector> InsMap;
   // Check and see if instance methods in class interface have been
   // implemented in the implementation class.
-  ObjcMethodDecl *const*methods = IMPDecl->getInstanceMethods();
-  for (int i=0; i < IMPDecl->getNumInstanceMethods(); i++) 
-    InsMap.insert(methods[i]->getSelector());
+  for (ObjcImplementationDecl::instmeth_iterator I = IMPDecl->instmeth_begin(),
+       E = IMPDecl->instmeth_end(); I != E; ++I)
+    InsMap.insert((*I)->getSelector());
   
   bool IncompleteImpl = false;
-  methods = IDecl->getInstanceMethods();
-  for (int j = 0; j < IDecl->getNumInstanceMethods(); j++)
-    if (!InsMap.count(methods[j]->getSelector())) {
-      Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
-           methods[j]->getSelector().getName());
+  for (ObjcInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(),
+       E = IDecl->instmeth_end(); I != E; ++I)
+    if (!InsMap.count((*I)->getSelector())) {
+      Diag((*I)->getLocation(), diag::warn_undef_method_impl,
+           (*I)->getSelector().getName());
       IncompleteImpl = true;
     }
+      
   llvm::DenseSet<Selector> ClsMap;
   // Check and see if class methods in class interface have been
   // implemented in the implementation class.
-  methods = IMPDecl->getClassMethods();
-  for (int i=0; i < IMPDecl->getNumClassMethods(); i++)
-    ClsMap.insert(methods[i]->getSelector());
-  
-  methods = IDecl->getClassMethods();
-  for (int j = 0; j < IDecl->getNumClassMethods(); j++)
-    if (!ClsMap.count(methods[j]->getSelector())) {
-      Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
-           methods[j]->getSelector().getName());
+  for (ObjcImplementationDecl::classmeth_iterator I =IMPDecl->classmeth_begin(),
+       E = IMPDecl->classmeth_end(); I != E; ++I)
+    ClsMap.insert((*I)->getSelector());
+  
+  for (ObjcInterfaceDecl::classmeth_iterator I = IDecl->classmeth_begin(),
+       E = IDecl->classmeth_end(); I != E; ++I)
+    if (!ClsMap.count((*I)->getSelector())) {
+      Diag((*I)->getLocation(), diag::warn_undef_method_impl,
+           (*I)->getSelector().getName());
       IncompleteImpl = true;
     }
   
@@ -529,12 +529,12 @@
   llvm::DenseSet<Selector> InsMap;
   // Check and see if instance methods in category interface have been
   // implemented in its implementation class.
-  ObjcMethodDecl *const*methods = CatImplDecl->getInstanceMethods();
-  for (int i=0; i < CatImplDecl->getNumInstanceMethods(); i++)
-    InsMap.insert(methods[i]->getSelector());
+  for (ObjcCategoryImplDecl::instmeth_iterator I =CatImplDecl->instmeth_begin(),
+       E = CatImplDecl->instmeth_end(); I != E; ++I)
+    InsMap.insert((*I)->getSelector());
   
   bool IncompleteImpl = false;
-  methods = CatClassDecl->getInstanceMethods();
+  ObjcMethodDecl *const* methods = CatClassDecl->getInstanceMethods();
   for (int j = 0; j < CatClassDecl->getNumInstanceMethods(); j++)
     if (!InsMap.count(methods[j]->getSelector())) {
       Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
@@ -544,9 +544,10 @@
   llvm::DenseSet<Selector> ClsMap;
   // Check and see if class methods in category interface have been
   // implemented in its implementation class.
-  methods = CatImplDecl->getClassMethods();
-  for (int i=0; i < CatImplDecl->getNumClassMethods(); i++)
-    ClsMap.insert(methods[i]->getSelector());
+  for (ObjcCategoryImplDecl::classmeth_iterator
+       I = CatImplDecl->classmeth_begin(), E = CatImplDecl->classmeth_end();
+       I != E; ++I)
+    ClsMap.insert((*I)->getSelector());
   
   methods = CatClassDecl->getClassMethods();
   for (int j = 0; j < CatClassDecl->getNumClassMethods(); j++)

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=44938&r1=44937&r2=44938&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Wed Dec 12 11:58:05 2007
@@ -775,7 +775,6 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
-			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Dec 12 11:58:05 2007
@@ -123,6 +123,18 @@
   ObjcMethodDecl** getClassMethods() const { return ClassMethods; }
   int getNumClassMethods() const { return NumClassMethods; }
   
+  typedef ObjcMethodDecl * const * instmeth_iterator;
+  instmeth_iterator instmeth_begin() const { return InstanceMethods; }
+  instmeth_iterator instmeth_end() const {
+    return InstanceMethods+NumInstanceMethods;
+  }
+  
+  typedef ObjcMethodDecl * const * classmeth_iterator;
+  classmeth_iterator classmeth_begin() const { return ClassMethods; }
+  classmeth_iterator classmeth_end() const {
+    return ClassMethods+NumClassMethods;
+  }
+  
   void addInstanceVariablesToClass(ObjcIvarDecl **ivars, unsigned numIvars,
                                    SourceLocation RBracLoc);
 





More information about the cfe-commits mailing list