summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-12-02 00:25:15 +0000
committerBob Wilson <bob.wilson@apple.com>2010-12-02 00:25:15 +0000
commit01856f38c2fadee131d48a6552ca5b1f0f44ed1d (patch)
tree6283fd842776e8c71b6b296e26992323fa2d203d /clang/lib/Sema
parent743eeae937b6113a7b4c3abf78fba7b7e0a7976c (diff)
downloadbcm5719-llvm-01856f38c2fadee131d48a6552ca5b1f0f44ed1d.tar.gz
bcm5719-llvm-01856f38c2fadee131d48a6552ca5b1f0f44ed1d.zip
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. llvm-svn: 120633
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index c115061164d..ac764ab8003 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud