diff options
author | Erich Keane <erich.keane@intel.com> | 2018-07-13 19:46:04 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-07-13 19:46:04 +0000 |
commit | f702b029f46e1644f9d4b859e88c09e121009562 (patch) | |
tree | 71cf5b2097457ef9919c9933f5fd2554162d134b /clang/lib/AST/ASTStructuralEquivalence.cpp | |
parent | 393fe62e3373c04ac9a2ab391335dfe6e08949e7 (diff) | |
download | bcm5719-llvm-f702b029f46e1644f9d4b859e88c09e121009562.tar.gz bcm5719-llvm-f702b029f46e1644f9d4b859e88c09e121009562.zip |
PR15730/PR16986 Allow dependently typed vector_size types.
As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.
In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.
Differential Revision: https://reviews.llvm.org/D49045
llvm-svn: 337036
Diffstat (limited to 'clang/lib/AST/ASTStructuralEquivalence.cpp')
-rw-r--r-- | clang/lib/AST/ASTStructuralEquivalence.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp index d158680a697..77e0d9e61bd 100644 --- a/clang/lib/AST/ASTStructuralEquivalence.cpp +++ b/clang/lib/AST/ASTStructuralEquivalence.cpp @@ -51,7 +51,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, /// Determine structural equivalence of two expressions. static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, - Expr *E1, Expr *E2) { + const Expr *E1, const Expr *E2) { if (!E1 || !E2) return E1 == E2; @@ -408,6 +408,20 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, break; } + case Type::DependentVector: { + const auto *Vec1 = cast<DependentVectorType>(T1); + const auto *Vec2 = cast<DependentVectorType>(T2); + if (Vec1->getVectorKind() != Vec2->getVectorKind()) + return false; + if (!IsStructurallyEquivalent(Context, Vec1->getSizeExpr(), + Vec2->getSizeExpr())) + return false; + if (!IsStructurallyEquivalent(Context, Vec1->getElementType(), + Vec2->getElementType())) + return false; + break; + } + case Type::Vector: case Type::ExtVector: { const auto *Vec1 = cast<VectorType>(T1); |