Skip to content

Commit ad11ef7

Browse files
authored
Merge pull request #67197 from slavapestov/simplify-get-type-parameter-packs
AST: Simplify TypeBase::getTypeParameterPacks()
2 parents 85b5af7 + cfd0414 commit ad11ef7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/AST/ParameterPack.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,16 @@ void TypeBase::walkPackReferences(
100100

101101
void TypeBase::getTypeParameterPacks(
102102
SmallVectorImpl<Type> &rootParameterPacks) {
103-
llvm::SmallSetVector<Type, 2> rootParameterPackSet;
104-
105103
walkPackReferences([&](Type t) {
106104
if (auto *paramTy = t->getAs<GenericTypeParamType>()) {
107105
if (paramTy->isParameterPack())
108-
rootParameterPackSet.insert(paramTy);
106+
rootParameterPacks.push_back(paramTy);
109107
} else if (auto *archetypeTy = t->getAs<PackArchetypeType>()) {
110-
rootParameterPackSet.insert(archetypeTy->getRoot());
108+
rootParameterPacks.push_back(archetypeTy->getRoot());
111109
}
112110

113111
return false;
114112
});
115-
116-
rootParameterPacks.append(rootParameterPackSet.begin(),
117-
rootParameterPackSet.end());
118113
}
119114

120115
bool GenericTypeParamType::isParameterPack() const {

0 commit comments

Comments
 (0)