diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-06-17 21:51:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-06-17 21:51:59 +0000 |
commit | 9cdda0cf8528e3d595be9bfa002f0450074beb4d (patch) | |
tree | 5ffc959c4c5f38e164c9be332cd27388ee0a86b6 /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 69e07a75ef2815961929f34675b7c806a9cc37da (diff) |
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
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 31c048d74c..fd5a460bfc 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -431,6 +431,32 @@ InstantiateDependentSizedArrayType(const DependentSizedArrayType *T, } 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 |