Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Apr 2015 18:38:38 +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: r281046 - head/contrib/llvm/tools/clang/lib/Sema
Message-ID:  <201504031838.t33IcccA014448@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Apr  3 18:38:37 2015
New Revision: 281046
URL: https://svnweb.freebsd.org/changeset/base/281046

Log:
  Pull in r227115 from upstream clang trunk (by Ben Langmuir):
  
    Fix assert instantiating string init of static variable
  
    ... when the variable's type is a typedef of a ConstantArrayType. Just
    look through the typedef (and any other sugar).  We only use the
    constant array type here to get the element count.
  
  This fixes an assertion failure when building the games/redeclipse port.
  
  Reported by:	amdmi3

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	Fri Apr  3 18:12:11 2015	(r281045)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp	Fri Apr  3 18:38:37 2015	(r281046)
@@ -149,9 +149,9 @@ static void updateStringLiteralType(Expr
 static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT,
                             Sema &S) {
   // Get the length of the string as parsed.
-  uint64_t StrLength =
-    cast<ConstantArrayType>(Str->getType())->getSize().getZExtValue();
-
+  auto *ConstantArrayTy =
+      cast<ConstantArrayType>(Str->getType()->getUnqualifiedDesugaredType());
+  uint64_t StrLength = ConstantArrayTy->getSize().getZExtValue();
 
   if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT)) {
     // C99 6.7.8p14. We have an array of character type with unknown size



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