Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2013 20:51:32 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254582 - head/contrib/llvm/tools/clang/lib/Sema
Message-ID:  <201308202051.r7KKpWHJ014990@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Aug 20 20:51:32 2013
New Revision: 254582
URL: http://svnweb.freebsd.org/changeset/base/254582

Log:
  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

Modified:
  head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp

Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp	Tue Aug 20 20:46:29 2013	(r254581)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp	Tue Aug 20 20:51:32 2013	(r254582)
@@ -774,6 +774,11 @@ void InitListChecker::CheckSubElementTyp
                                           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::CheckSubElementTyp
     // 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308202051.r7KKpWHJ014990>