forked from OSchip/llvm-project
Implement feedback from Eli re: the purpose of lax vector conversions
llvm-svn: 74397
This commit is contained in:
parent
c8ca49659a
commit
c8961a424d
|
@ -2931,19 +2931,8 @@ bool Sema::CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty) {
|
||||||
bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, QualType SrcTy) {
|
bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, QualType SrcTy) {
|
||||||
assert(DestTy->isExtVectorType() && "Not an extended vector type!");
|
assert(DestTy->isExtVectorType() && "Not an extended vector type!");
|
||||||
|
|
||||||
// If SrcTy is also an ExtVectorType, the types must be identical unless
|
// If SrcTy is a VectorType, the total size must match to explicitly cast to
|
||||||
// lax vector conversions is enabled.
|
// an ExtVectorType.
|
||||||
if (SrcTy->isExtVectorType()) {
|
|
||||||
if (getLangOptions().LaxVectorConversions &&
|
|
||||||
Context.getTypeSize(DestTy) == Context.getTypeSize(SrcTy))
|
|
||||||
return false;
|
|
||||||
if (DestTy != SrcTy)
|
|
||||||
return Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors)
|
|
||||||
<< DestTy << SrcTy << R;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If SrcTy is a VectorType, then only the total size must match.
|
|
||||||
if (SrcTy->isVectorType()) {
|
if (SrcTy->isVectorType()) {
|
||||||
if (Context.getTypeSize(DestTy) != Context.getTypeSize(SrcTy))
|
if (Context.getTypeSize(DestTy) != Context.getTypeSize(SrcTy))
|
||||||
return Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors)
|
return Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors)
|
||||||
|
|
Loading…
Reference in New Issue