From 1df5109f475bcbc528eb1fb9fdb179dcadbb33a6 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 10 Aug 2009 03:01:36 +0000 Subject: Revert r78535, it is causing a number of failures to build projects. --- Reverse-merging r78535 into '.': D test/Sema/altivec-init.c U include/clang/Basic/DiagnosticSemaKinds.td U include/clang/AST/Expr.h U include/clang/AST/StmtNodes.def U include/clang/Parse/Parser.h U include/clang/Parse/Action.h U tools/clang-cc/clang-cc.cpp U lib/Frontend/PrintParserCallbacks.cpp U lib/CodeGen/CGExprScalar.cpp U lib/Sema/SemaInit.cpp U lib/Sema/Sema.h U lib/Sema/SemaExpr.cpp U lib/Sema/SemaTemplateInstantiateExpr.cpp U lib/AST/StmtProfile.cpp U lib/AST/Expr.cpp U lib/AST/StmtPrinter.cpp U lib/Parse/ParseExpr.cpp U lib/Parse/ParseExprCXX.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78551 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaInit.cpp | 45 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) (limited to 'lib/Sema/SemaInit.cpp') diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 1e564ce45f..29113822f7 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -805,47 +805,16 @@ void InitListChecker::CheckVectorType(InitListExpr *IList, QualType DeclType, unsigned &StructuredIndex) { if (Index < IList->getNumInits()) { const VectorType *VT = DeclType->getAsVectorType(); - unsigned maxElements = VT->getNumElements(); - unsigned numEltsInit = 0; + int maxElements = VT->getNumElements(); QualType elementType = VT->getElementType(); - if (!SemaRef.getLangOptions().OpenCL) { - for (unsigned i = 0; i < maxElements; ++i, ++numEltsInit) { - // Don't attempt to go past the end of the init list - if (Index >= IList->getNumInits()) - break; - CheckSubElementType(IList, elementType, Index, - StructuredList, StructuredIndex); - } - } else { - // OpenCL initializers allows vectors to be constructed from vectors. - for (unsigned i = 0; i < maxElements; ++i) { - // Don't attempt to go past the end of the init list - if (Index >= IList->getNumInits()) - break; - QualType IType = IList->getInit(Index)->getType(); - if (!IType->isVectorType()) { - CheckSubElementType(IList, elementType, Index, - StructuredList, StructuredIndex); - ++numEltsInit; - } else { - const VectorType *IVT = IType->getAsVectorType(); - unsigned numIElts = IVT->getNumElements(); - QualType VecType = SemaRef.Context.getExtVectorType(elementType, - numIElts); - CheckSubElementType(IList, VecType, Index, - StructuredList, StructuredIndex); - numEltsInit += numIElts; - } - } + for (int i = 0; i < maxElements; ++i) { + // Don't attempt to go past the end of the init list + if (Index >= IList->getNumInits()) + break; + CheckSubElementType(IList, elementType, Index, + StructuredList, StructuredIndex); } - - // OpenCL & AltiVec require all elements to be initialized. - if (numEltsInit != maxElements) - if (SemaRef.getLangOptions().OpenCL || SemaRef.getLangOptions().AltiVec) - SemaRef.Diag(IList->getSourceRange().getBegin(), - diag::err_vector_incorrect_num_initializers) - << (numEltsInit < maxElements) << maxElements << numEltsInit; } } -- cgit v1.2.3-18-g5258