From b313461802c9d2049e02923414f94da608d32c8a Mon Sep 17 00:00:00 2001 From: emaste Date: Sat, 24 Aug 2013 14:33:11 +0000 Subject: [PATCH] MFS r254728: Pull in r182983 from upstream clang trunk: Fix handling of braced-init-list as reference initializer within aggregate initialization. Previously we would incorrectly require an extra set of braces around such initializers. Pull in r188718 from upstream clang trunk: Handle init lists and _Atomic fields. Fixes PR16931. These fixes are needed for the atomic_flag type to work correctly in our stdatomic.h. Approved by: re git-svn-id: svn://svn.freebsd.org/base/releng/9.2@254786 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp index 9e8936e1..a632f022 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp @@ -774,6 +774,11 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, InitListExpr *StructuredList, unsigned &StructuredIndex) { Expr *expr = IList->getInit(Index); + + if (ElemType->isReferenceType()) + return CheckReferenceType(Entity, IList, ElemType, Index, + StructuredList, StructuredIndex); + if (InitListExpr *SubInitList = dyn_cast(expr)) { if (!ElemType->isRecordType() || ElemType->isAggregateType()) { unsigned newIndex = 0; @@ -793,13 +798,13 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // C++ initialization is handled later. } - if (ElemType->isScalarType()) { + // FIXME: Need to handle atomic aggregate types with implicit init lists. + if (ElemType->isScalarType() || ElemType->isAtomicType()) return CheckScalarType(Entity, IList, ElemType, Index, StructuredList, StructuredIndex); - } else if (ElemType->isReferenceType()) { - return CheckReferenceType(Entity, IList, ElemType, Index, - StructuredList, StructuredIndex); - } + + assert((ElemType->isRecordType() || ElemType->isVectorType() || + ElemType->isArrayType()) && "Unexpected type"); if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) { // arrayType can be incomplete if we're initializing a flexible -- 2.45.0