@@ -677,21 +677,19 @@ bool Sema::CheckParameterPacksForExpansion(
677
677
Optional<unsigned > NumPartialExpansions;
678
678
SourceLocation PartiallySubstitutedPackLoc;
679
679
680
- for (ArrayRef<UnexpandedParameterPack>::iterator i = Unexpanded.begin (),
681
- end = Unexpanded.end ();
682
- i != end; ++i) {
680
+ for (UnexpandedParameterPack ParmPack : Unexpanded) {
683
681
// Compute the depth and index for this parameter pack.
684
682
unsigned Depth = 0 , Index = 0 ;
685
683
IdentifierInfo *Name;
686
684
bool IsVarDeclPack = false ;
687
685
688
- if (const TemplateTypeParmType *TTP
689
- = i-> first .dyn_cast <const TemplateTypeParmType *>()) {
686
+ if (const TemplateTypeParmType *TTP =
687
+ ParmPack. first .dyn_cast <const TemplateTypeParmType *>()) {
690
688
Depth = TTP->getDepth ();
691
689
Index = TTP->getIndex ();
692
690
Name = TTP->getIdentifier ();
693
691
} else {
694
- NamedDecl *ND = i-> first .get <NamedDecl *>();
692
+ NamedDecl *ND = ParmPack. first .get <NamedDecl *>();
695
693
if (isa<VarDecl>(ND))
696
694
IsVarDeclPack = true ;
697
695
else
@@ -706,9 +704,9 @@ bool Sema::CheckParameterPacksForExpansion(
706
704
// Figure out whether we're instantiating to an argument pack or not.
707
705
typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
708
706
709
- llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
710
- = CurrentInstantiationScope->findInstantiationOf (
711
- i-> first .get <NamedDecl *>());
707
+ llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation =
708
+ CurrentInstantiationScope->findInstantiationOf (
709
+ ParmPack. first .get <NamedDecl *>());
712
710
if (Instantiation->is <DeclArgumentPack *>()) {
713
711
// We could expand this function parameter pack.
714
712
NewPackSize = Instantiation->get <DeclArgumentPack *>()->size ();
@@ -745,7 +743,7 @@ bool Sema::CheckParameterPacksForExpansion(
745
743
RetainExpansion = true ;
746
744
// We don't actually know the new pack size yet.
747
745
NumPartialExpansions = NewPackSize;
748
- PartiallySubstitutedPackLoc = i-> second ;
746
+ PartiallySubstitutedPackLoc = ParmPack. second ;
749
747
continue ;
750
748
}
751
749
}
@@ -756,7 +754,7 @@ bool Sema::CheckParameterPacksForExpansion(
756
754
// Record it.
757
755
NumExpansions = NewPackSize;
758
756
FirstPack.first = Name;
759
- FirstPack.second = i-> second ;
757
+ FirstPack.second = ParmPack. second ;
760
758
HaveFirstPack = true ;
761
759
continue ;
762
760
}
@@ -767,12 +765,12 @@ bool Sema::CheckParameterPacksForExpansion(
767
765
// the same number of arguments specified.
768
766
if (HaveFirstPack)
769
767
Diag (EllipsisLoc, diag::err_pack_expansion_length_conflict)
770
- << FirstPack.first << Name << *NumExpansions << NewPackSize
771
- << SourceRange (FirstPack.second ) << SourceRange (i-> second );
768
+ << FirstPack.first << Name << *NumExpansions << NewPackSize
769
+ << SourceRange (FirstPack.second ) << SourceRange (ParmPack. second );
772
770
else
773
771
Diag (EllipsisLoc, diag::err_pack_expansion_length_conflict_multilevel)
774
- << Name << *NumExpansions << NewPackSize
775
- << SourceRange (i-> second );
772
+ << Name << *NumExpansions << NewPackSize
773
+ << SourceRange (ParmPack. second );
776
774
return true ;
777
775
}
778
776
}
0 commit comments