svn commit: r261794 - in stable: 10/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/lib/Sema

Dimitry Andric dim at FreeBSD.org
Wed Feb 12 07:51:15 UTC 2014


Author: dim
Date: Wed Feb 12 07:51:14 2014
New Revision: 261794
URL: http://svnweb.freebsd.org/changeset/base/261794

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

Modified:
  stable/9/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
Directory Properties:
  stable/9/contrib/llvm/   (props changed)
  stable/9/contrib/llvm/tools/clang/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h	Wed Feb 12 07:24:37 2014	(r261793)
+++ stable/9/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h	Wed Feb 12 07:51:14 2014	(r261794)
@@ -3837,7 +3837,9 @@ TreeTransform<Derived>::TransformVariabl
       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);


More information about the svn-src-stable-9 mailing list