Unnest; no functionality change.

llvm-svn: 118753
This commit is contained in:
John McCall 2010-11-11 00:46:36 +00:00
parent c87c843db7
commit 643169b280
1 changed files with 42 additions and 42 deletions

View File

@ -735,7 +735,15 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
unsigned &Index,
InitListExpr *StructuredList,
unsigned &StructuredIndex) {
if (Index < IList->getNumInits()) {
if (Index >= IList->getNumInits()) {
SemaRef.Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
<< IList->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
return;
}
Expr *expr = IList->getInit(Index);
if (InitListExpr *SubIList = dyn_cast<InitListExpr>(expr)) {
SemaRef.Diag(SubIList->getLocStart(),
@ -776,14 +784,6 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
else
UpdateStructuredListElement(StructuredList, StructuredIndex, ResultExpr);
++Index;
} else {
SemaRef.Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
<< IList->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
return;
}
}
void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,