summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCXXCast.cpp
diff options
context:
space:
mode:
authorAnton Yartsev <anton.yartsev@gmail.com>2011-03-27 09:32:40 +0000
committerAnton Yartsev <anton.yartsev@gmail.com>2011-03-27 09:32:40 +0000
commit28ccef788bb23d50ab17e3db6c5d0ee35a7af8d6 (patch)
tree20fe7852ac976e2a088bde23d1ba656a4d8cb61b /clang/lib/Sema/SemaCXXCast.cpp
parent358d056c148bdeebb502ab94edd97eb1637f6f92 (diff)
downloadbcm5719-llvm-28ccef788bb23d50ab17e3db6c5d0ee35a7af8d6.tar.gz
bcm5719-llvm-28ccef788bb23d50ab17e3db6c5d0ee35a7af8d6.zip
supported: AltiVec vector initialization with a single literal according to PIM section 2.5.1 - after initialization all elements have the value specified by the literal
llvm-svn: 128375
Diffstat (limited to 'clang/lib/Sema/SemaCXXCast.cpp')
-rw-r--r--clang/lib/Sema/SemaCXXCast.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp
index 557d27a9438..d10042ad034 100644
--- a/clang/lib/Sema/SemaCXXCast.cpp
+++ b/clang/lib/Sema/SemaCXXCast.cpp
@@ -1517,6 +1517,16 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, ExprValueKind &VK,
return ret;
}
+ // Case of AltiVec vector initialization with a single literal
+ if (CastTy->isVectorType()
+ && CastTy->getAs<VectorType>()->getVectorKind() ==
+ VectorType::AltiVecVector
+ && (CastExpr->getType()->isIntegerType()
+ || CastExpr->getType()->isFloatingType())) {
+ Kind = CK_VectorSplat;
+ return false;
+ }
+
// Make sure we determine the value kind before we bail out for
// dependent types.
VK = Expr::getValueKindForType(CastTy);
OpenPOWER on IntegriCloud