summaryrefslogtreecommitdiffstats
path: root/contrib/llvm
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-02-09 20:52:47 +0000
committerdim <dim@FreeBSD.org>2014-02-09 20:52:47 +0000
commit890577ec234f223fbf6760eeeec25811a5c388b3 (patch)
tree905e353ba87b28dc47004f976db102d2eebe61e2 /contrib/llvm
parent555263254f4f77204e248fb7a565f322df5455bc (diff)
downloadFreeBSD-src-890577ec234f223fbf6760eeeec25811a5c388b3.zip
FreeBSD-src-890577ec234f223fbf6760eeeec25811a5c388b3.tar.gz
Pull in r200899 from upstream clang trunk:
Allow transformation of VariableArray to ConstantArray. In the following code: struct A { static const int sz; }; template<class T> void f() { T arr[A::sz]; } the array 'arr' is represented as a variable size array in the template. If 'A::sz' gets value below in the translation unit, the array in instantiation can turn into constant size array. This change fixes PR18633. Differential Revision: http://llvm-reviews.chandlerc.com/D2688 This fixes "Assertion failed: (T::isKind(*this)), function castAs" errors, which can occur when building the security/quantis port. Reported by: ale MFC after: 3 days
Diffstat (limited to 'contrib/llvm')
-rw-r--r--contrib/llvm/tools/clang/lib/Sema/TreeTransform.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h b/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
index 89e23ef..faa47e8 100644
--- a/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
+++ b/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
@@ -3837,7 +3837,9 @@ TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
return QualType();
}
- VariableArrayTypeLoc NewTL = TLB.push<VariableArrayTypeLoc>(Result);
+ // We might have constant size array now, but fortunately it has the same
+ // location layout.
+ ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
NewTL.setLBracketLoc(TL.getLBracketLoc());
NewTL.setRBracketLoc(TL.getRBracketLoc());
NewTL.setSizeExpr(Size);
OpenPOWER on IntegriCloud