[cfe-commits] r44941 - /cfe/trunk/Sema/SemaDeclObjC.cpp

Chris Lattner sabre at nondot.org
Wed Dec 12 10:11:49 PST 2007


Author: lattner
Date: Wed Dec 12 12:11:49 2007
New Revision: 44941

URL: http://llvm.org/viewvc/llvm-project?rev=44941&view=rev
Log:
simplify some code, bump j.  This fixes the remaining test failures.

Modified:
    cfe/trunk/Sema/SemaDeclObjC.cpp

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

==============================================================================
--- cfe/trunk/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/Sema/SemaDeclObjC.cpp Wed Dec 12 12:11:49 2007
@@ -414,11 +414,10 @@
   // names and types must match.
   //
   unsigned j = 0;
-  bool err = false;
   ObjcInterfaceDecl::ivar_iterator 
     IVI = IDecl->ivar_begin(), IVE = IDecl->ivar_end();
   for (; numIvars > 0 && IVI != IVE; ++IVI) {
-    ObjcIvarDecl* ImplIvar = ivars[j];
+    ObjcIvarDecl* ImplIvar = ivars[j++];
     ObjcIvarDecl* ClsIvar = *IVI;
     assert (ImplIvar && "missing implementation ivar");
     assert (ClsIvar && "missing class ivar");
@@ -435,15 +434,15 @@
            ImplIvar->getIdentifier()->getName());
       Diag(ClsIvar->getLocation(), diag::err_previous_definition,
            ClsIvar->getIdentifier()->getName());
-      err = true;
-      break;
+      return;
     }
     --numIvars;
   }
-  if (!err && (numIvars > 0 || IVI != IVE))
-    Diag(numIvars > 0 ? ivars[j]->getLocation() : (*IVI)->getLocation(), 
-         diag::err_inconsistant_ivar);
-      
+  
+  if (numIvars > 0)
+    Diag(ivars[j]->getLocation(), diag::err_inconsistant_ivar);
+  else if (IVI != IVE)
+    Diag((*IVI)->getLocation(), diag::err_inconsistant_ivar);
 }
 
 /// CheckProtocolMethodDefs - This routine checks unimpletented methods





More information about the cfe-commits mailing list