Replace Sema::CheckVariableInitList, CheckConstantInitList, and CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers.
This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-)
Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46339 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 32a587c..c402bae 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -740,16 +740,8 @@
bool CheckSingleInitializer(Expr *&simpleInit, QualType declType);
bool CheckInitExpr(Expr *expr, InitListExpr *IList, unsigned slot,
QualType ElementType);
-
- void CheckVariableInitList(QualType DeclType, InitListExpr *IList,
- QualType ElementType,
- int &nInitializers, bool &hadError);
- void CheckConstantInitList(QualType DeclType, InitListExpr *IList,
- QualType ElementType,
- int &nInitializers, bool &hadError);
- bool CheckForCharArrayInitializer(InitListExpr *IList, QualType ElementType,
- int &nInitializers, bool isConstant,
- bool &hadError);
+ bool CheckInitializerListTypes(InitListExpr*& IList, QualType &DeclType,
+ bool topLevel, unsigned& startIndex);
bool CheckForConstantInitializer(Expr *e, QualType t);
StringLiteral *IsStringLiteralInit(Expr *Init, QualType DeclType);