simplify some code, bump j. This fixes the remaining test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44941 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDeclObjC.cpp b/Sema/SemaDeclObjC.cpp
index 376e8e6..1a56e48 100644
--- a/Sema/SemaDeclObjC.cpp
+++ b/Sema/SemaDeclObjC.cpp
@@ -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