svn commit: r281046 - head/contrib/llvm/tools/clang/lib/Sema
Dimitry Andric
dim at FreeBSD.org
Fri Apr 3 18:38:38 UTC 2015
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
More information about the svn-src-head
mailing list