Adjust warning so that it doesn't fire when there is an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51269 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 94ddd04..d5378d3 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -98,9 +98,6 @@
void InitListChecker::CheckExplicitInitList(InitListExpr *IList, QualType &T,
unsigned &Index) {
assert(IList->isExplicit() && "Illegal Implicit InitListExpr");
- if (T->isScalarType())
- SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init,
- IList->getSourceRange());
CheckListElementTypes(IList, T, Index);
IList->setType(T);
@@ -120,6 +117,10 @@
IList->getInit(Index)->getSourceRange());
}
}
+
+ if (!hadError && T->isScalarType())
+ SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init,
+ IList->getSourceRange());
}
void InitListChecker::CheckListElementTypes(InitListExpr *IList,