@@ -5558,7 +5558,8 @@ bool Sema::BuiltinComplex(CallExpr *TheCall) {
5558
5558
/// BuiltinShuffleVector - Handle __builtin_shufflevector.
5559
5559
// This is declared to take (...), so we have to check everything.
5560
5560
ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
5561
- if (TheCall->getNumArgs() < 2)
5561
+ unsigned NumArgs = TheCall->getNumArgs();
5562
+ if (NumArgs < 2)
5562
5563
return ExprError(Diag(TheCall->getEndLoc(),
5563
5564
diag::err_typecheck_call_too_few_args_at_least)
5564
5565
<< 0 /*function call*/ << 2 << TheCall->getNumArgs()
@@ -5567,8 +5568,8 @@ ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
5567
5568
// Determine which of the following types of shufflevector we're checking:
5568
5569
// 1) unary, vector mask: (lhs, mask)
5569
5570
// 2) binary, scalar mask: (lhs, rhs, index, ..., index)
5570
- QualType resType = TheCall->getArg(0)->getType();
5571
- unsigned numElements = 0;
5571
+ QualType ResType = TheCall->getArg(0)->getType();
5572
+ unsigned NumElements = 0;
5572
5573
5573
5574
if (!TheCall->getArg(0)->isTypeDependent() &&
5574
5575
!TheCall->getArg(1)->isTypeDependent()) {
@@ -5582,39 +5583,39 @@ ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
5582
5583
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
5583
5584
TheCall->getArg(1)->getEndLoc()));
5584
5585
5585
- numElements = LHSType->castAs<VectorType>()->getNumElements();
5586
- unsigned numResElements = TheCall->getNumArgs() - 2;
5586
+ NumElements = LHSType->castAs<VectorType>()->getNumElements();
5587
+ unsigned NumResElements = TheCall->getNumArgs() - 2;
5587
5588
5588
5589
// Check to see if we have a call with 2 vector arguments, the unary shuffle
5589
5590
// with mask. If so, verify that RHS is an integer vector type with the
5590
5591
// same number of elts as lhs.
5591
5592
if (TheCall->getNumArgs() == 2) {
5592
5593
if (!RHSType->hasIntegerRepresentation() ||
5593
- RHSType->castAs<VectorType>()->getNumElements() != numElements )
5594
+ RHSType->castAs<VectorType>()->getNumElements() != NumElements )
5594
5595
return ExprError(Diag(TheCall->getBeginLoc(),
5595
5596
diag::err_vec_builtin_incompatible_vector)
5596
5597
<< TheCall->getDirectCallee()
5597
- << /*isMorethantwoArgs */ false
5598
+ << /*isMoreThanTwoArgs */ false
5598
5599
<< SourceRange(TheCall->getArg(1)->getBeginLoc(),
5599
5600
TheCall->getArg(1)->getEndLoc()));
5600
5601
} else if (!Context.hasSameUnqualifiedType(LHSType, RHSType)) {
5601
5602
return ExprError(Diag(TheCall->getBeginLoc(),
5602
5603
diag::err_vec_builtin_incompatible_vector)
5603
5604
<< TheCall->getDirectCallee()
5604
- << /*isMorethantwoArgs */ false
5605
+ << /*isMoreThanTwoArgs */ false
5605
5606
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
5606
5607
TheCall->getArg(1)->getEndLoc()));
5607
- } else if (numElements != numResElements ) {
5608
+ } else if (NumElements != NumResElements ) {
5608
5609
QualType eltType = LHSType->castAs<VectorType>()->getElementType();
5609
- resType = resType ->isExtVectorType()
5610
- ? Context.getExtVectorType(eltType, numResElements )
5611
- : Context.getVectorType(eltType, numResElements ,
5610
+ ResType = ResType ->isExtVectorType()
5611
+ ? Context.getExtVectorType(eltType, NumResElements )
5612
+ : Context.getVectorType(eltType, NumResElements ,
5612
5613
VectorKind::Generic);
5613
5614
}
5614
5615
}
5615
5616
5616
- for (unsigned i = 2; i < TheCall->getNumArgs(); i++ ) {
5617
- Expr *Arg = TheCall->getArg(i );
5617
+ for (unsigned I = 2; I != NumArgs; ++I ) {
5618
+ Expr *Arg = TheCall->getArg(I );
5618
5619
if (Arg->isTypeDependent() || Arg->isValueDependent())
5619
5620
continue;
5620
5621
@@ -5628,21 +5629,21 @@ ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
5628
5629
if (Result->isSigned() && Result->isAllOnes())
5629
5630
;
5630
5631
else if (Result->getActiveBits() > 64 ||
5631
- Result->getZExtValue() >= numElements * 2)
5632
+ Result->getZExtValue() >= NumElements * 2)
5632
5633
return ExprError(Diag(TheCall->getBeginLoc(),
5633
5634
diag::err_shufflevector_argument_too_large)
5634
5635
<< Arg->getSourceRange());
5635
5636
5636
- TheCall->setArg(i , ConstantExpr::Create(Context, Arg, APValue(*Result)));
5637
+ TheCall->setArg(I , ConstantExpr::Create(Context, Arg, APValue(*Result)));
5637
5638
}
5638
5639
5639
- SmallVector<Expr *> exprs ;
5640
- for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i ++) {
5641
- exprs .push_back(TheCall->getArg(i ));
5642
- TheCall->setArg(i , nullptr);
5640
+ SmallVector<Expr *> Exprs ;
5641
+ for (unsigned I = 0; I != NumArgs; I ++) {
5642
+ Exprs .push_back(TheCall->getArg(I ));
5643
+ TheCall->setArg(I , nullptr);
5643
5644
}
5644
5645
5645
- return new (Context) ShuffleVectorExpr(Context, exprs, resType ,
5646
+ return new (Context) ShuffleVectorExpr(Context, Exprs, ResType ,
5646
5647
TheCall->getCallee()->getBeginLoc(),
5647
5648
TheCall->getRParenLoc());
5648
5649
}
0 commit comments