diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-12-02 00:25:15 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-12-02 00:25:15 +0000 |
commit | de3deea82767a2c418fa1b5828a3744326ffd9c3 (patch) | |
tree | 1b88fe9f17c2933856e291eda4df795577eb25ab | |
parent | 3a1c36c099df4dcc94d1d24516a8a2c809c764d4 (diff) |
Swap order of checking for compatible vector types.
Check for compatible gcc, Altivec and Neon vectors before handling the
lax-vector-conversions case. Otherwise there is no way to avoid the
warnings from -Wvector-conversions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120633 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index c115061164..ac764ab800 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5461,6 +5461,13 @@ Sema::CheckAssignmentConstraints(QualType lhsType, Expr *&rhs, if (lhsType->isVectorType() || rhsType->isVectorType()) { if (lhsType->isVectorType() && rhsType->isVectorType()) { + // Allow assignments of an AltiVec vector type to an equivalent GCC + // vector type and vice versa + if (Context.areCompatibleVectorTypes(lhsType, rhsType)) { + Kind = CK_BitCast; + return Compatible; + } + // If we are allowing lax vector conversions, and LHS and RHS are both // vectors, the total size only needs to be the same. This is a bitcast; // no bits are changed but the result type is different. @@ -5469,13 +5476,6 @@ Sema::CheckAssignmentConstraints(QualType lhsType, Expr *&rhs, Kind = CK_BitCast; return IncompatibleVectors; } - - // Allow assignments of an AltiVec vector type to an equivalent GCC - // vector type and vice versa - if (Context.areCompatibleVectorTypes(lhsType, rhsType)) { - Kind = CK_BitCast; - return Compatible; - } } return Incompatible; } |