mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
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
This commit is contained in:
parent
df2637d88a
commit
992b133da5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254582
@ -774,6 +774,11 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
|
|||||||
InitListExpr *StructuredList,
|
InitListExpr *StructuredList,
|
||||||
unsigned &StructuredIndex) {
|
unsigned &StructuredIndex) {
|
||||||
Expr *expr = IList->getInit(Index);
|
Expr *expr = IList->getInit(Index);
|
||||||
|
|
||||||
|
if (ElemType->isReferenceType())
|
||||||
|
return CheckReferenceType(Entity, IList, ElemType, Index,
|
||||||
|
StructuredList, StructuredIndex);
|
||||||
|
|
||||||
if (InitListExpr *SubInitList = dyn_cast<InitListExpr>(expr)) {
|
if (InitListExpr *SubInitList = dyn_cast<InitListExpr>(expr)) {
|
||||||
if (!ElemType->isRecordType() || ElemType->isAggregateType()) {
|
if (!ElemType->isRecordType() || ElemType->isAggregateType()) {
|
||||||
unsigned newIndex = 0;
|
unsigned newIndex = 0;
|
||||||
@ -793,13 +798,13 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
|
|||||||
// C++ initialization is handled later.
|
// 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,
|
return CheckScalarType(Entity, IList, ElemType, Index,
|
||||||
StructuredList, StructuredIndex);
|
StructuredList, StructuredIndex);
|
||||||
} else if (ElemType->isReferenceType()) {
|
|
||||||
return CheckReferenceType(Entity, IList, ElemType, Index,
|
assert((ElemType->isRecordType() || ElemType->isVectorType() ||
|
||||||
StructuredList, StructuredIndex);
|
ElemType->isArrayType()) && "Unexpected type");
|
||||||
}
|
|
||||||
|
|
||||||
if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) {
|
if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) {
|
||||||
// arrayType can be incomplete if we're initializing a flexible
|
// arrayType can be incomplete if we're initializing a flexible
|
||||||
|
Loading…
Reference in New Issue
Block a user