Support dependent extended vector types and template instantiation
thereof. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73641 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 31c048d..fd5a460 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -431,6 +431,32 @@
 }
 
 QualType 
+TemplateTypeInstantiator::
+InstantiateDependentSizedExtVectorType(const DependentSizedExtVectorType *T,
+                                   unsigned Quals) const {
+
+  // Instantiate the element type if needed
+  QualType ElementType = T->getElementType();
+  if (ElementType->isDependentType()) {
+    ElementType = Instantiate(ElementType);
+    if (ElementType.isNull())
+      return QualType();
+  }
+
+  // Instantiate the size expression
+  Expr *SizeExpr = T->getSizeExpr();
+  Sema::OwningExprResult InstantiatedArraySize = 
+    SemaRef.InstantiateExpr(SizeExpr, TemplateArgs);
+  if (InstantiatedArraySize.isInvalid())
+    return QualType();
+  
+  return SemaRef.BuildExtVectorType(ElementType,
+                                    SemaRef.Owned(
+                                      InstantiatedArraySize.takeAs<Expr>()),
+                                    T->getAttributeLoc());
+}
+
+QualType 
 TemplateTypeInstantiator::InstantiateVectorType(const VectorType *T,
                                              unsigned Quals) const {
   // FIXME: Implement this