Skip to content

Commit 3440234

Browse files
committed
Generalise addTupleOf
Allow it to iterate over an arbitrary container type.
1 parent 1b2a4ac commit 3440234

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/IDE/Refactoring.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5807,8 +5807,8 @@ class AsyncConverter : private SourceEntityWalker {
58075807

58085808
/// Prints a tuple of elements, or a lone single element if only one is
58095809
/// present, using the provided printing function.
5810-
template <typename T, typename PrintFn>
5811-
void addTupleOf(ArrayRef<T> Elements, llvm::raw_ostream &OS,
5810+
template <typename Container, typename PrintFn>
5811+
void addTupleOf(const Container &Elements, llvm::raw_ostream &OS,
58125812
PrintFn PrintElt) {
58135813
if (Elements.size() == 1) {
58145814
PrintElt(Elements[0]);
@@ -5909,8 +5909,7 @@ class AsyncConverter : private SourceEntityWalker {
59095909
// cont.resume(returning: (res1, res2, ...))
59105910
OS << ContName << tok::period << "resume" << tok::l_paren;
59115911
OS << "returning" << tok::colon << " ";
5912-
addTupleOf(llvm::makeArrayRef(SuccessParamNames), OS,
5913-
[&](auto Ref) { OS << Ref; });
5912+
addTupleOf(SuccessParamNames, OS, [&](auto Ref) { OS << Ref; });
59145913
OS << tok::r_paren << "\n";
59155914
break;
59165915
}

0 commit comments

Comments
 (0)