diff options
author | dim <dim@FreeBSD.org> | 2013-08-20 20:51:32 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-08-20 20:51:32 +0000 |
commit | 77157c02d9320e321e8c549f9af38ef7809e4cea (patch) | |
tree | 130438917337119efe5a55b9753ef3814fe1f225 | |
parent | be9185df2cce48a086d57c7f8bc6bad5030db6a4 (diff) | |
download | FreeBSD-src-77157c02d9320e321e8c549f9af38ef7809e4cea.zip FreeBSD-src-77157c02d9320e321e8c549f9af38ef7809e4cea.tar.gz |
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.
Requested by: theraven
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp | 15 |
1 files 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 9e8936e..a632f02 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<InitListExpr>(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 |