@@ -959,14 +959,15 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
959959 return New;
960960}
961961
962- namespace {
963962// CheckBindingsCount
964963// - Checks the arity of the structured bindings
965964// - Creates the resolved pack expr if there is
966965// one
967- bool CheckBindingsCount(Sema &S, DecompositionDecl *DD, QualType DecompType,
968- ArrayRef<BindingDecl *> Bindings,
969- unsigned MemberCount) {
966+
967+ static bool CheckBindingsCount(Sema &S, DecompositionDecl *DD,
968+ QualType DecompType,
969+ ArrayRef<BindingDecl *> Bindings,
970+ unsigned MemberCount) {
970971 auto BindingWithPackItr =
971972 std::find_if(Bindings.begin(), Bindings.end(),
972973 [](BindingDecl *D) -> bool { return D->isParameterPack(); });
@@ -1058,7 +1059,6 @@ struct BindingInitWalker {
10581059 ++BindingItr;
10591060 }
10601061};
1061- } // namespace
10621062
10631063static bool checkSimpleDecomposition(
10641064 Sema &S, ArrayRef<BindingDecl *> Bindings, ValueDecl *Src,
@@ -1619,35 +1619,6 @@ static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
16191619 return false;
16201620}
16211621
1622- unsigned Sema::GetDecompositionElementCount(QualType DecompType) {
1623- assert(!DecompType->isDependentType() && "expecting non-dependent type");
1624- SourceLocation Loc = SourceLocation(); // FIXME
1625- DecompType = DecompType.getNonReferenceType();
1626- if (auto *CAT = Context.getAsConstantArrayType(DecompType))
1627- return CAT->getSize().getLimitedValue(UINT_MAX);
1628- if (auto *VT = DecompType->getAs<VectorType>())
1629- return VT->getNumElements();
1630- if (auto *CT = DecompType->getAs<ComplexType>())
1631- return 2;
1632- llvm::APSInt TupleSize(32);
1633- if (IsTupleLike TL = isTupleLike(*this, Loc, DecompType, TupleSize);
1634- TL == IsTupleLike::TupleLike)
1635- return (unsigned)TupleSize.getLimitedValue(UINT_MAX);
1636-
1637- if (CXXRecordDecl *RD = DecompType->getAsCXXRecordDecl();
1638- RD && !RD->isUnion()) {
1639- CXXCastPath BasePath;
1640- DeclAccessPair BasePair =
1641- findDecomposableBaseClass(*this, Loc, RD, BasePath);
1642- RD = cast_or_null<CXXRecordDecl>(BasePair.getDecl());
1643- if (RD)
1644- return llvm::count_if(
1645- RD->fields(), [](FieldDecl *FD) { return !FD->isUnnamedBitField(); });
1646- }
1647-
1648- llvm_unreachable("unknown type for decomposition");
1649- }
1650-
16511622void Sema::CheckCompleteDecompositionDeclaration(DecompositionDecl *DD) {
16521623 QualType DecompType = DD->getType();
16531624
0 commit comments