Skip to content

Commit 3392c6e

Browse files
committed
use interleaveComma
1 parent 28a5f09 commit 3392c6e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

clang/lib/AST/TypePrinter.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,14 +1912,9 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
19121912
}
19131913
if (T->getAttrKind() == attr::LifetimeCaptureBy) {
19141914
OS << " [[clang::lifetime_capture_by(";
1915-
if (auto *attr = dyn_cast_or_null<LifetimeCaptureByAttr>(T->getAttr())) {
1916-
auto Idents = attr->getArgIdents();
1917-
for (unsigned I = 0; I < Idents.size(); ++I) {
1918-
OS << Idents[I]->getName();
1919-
if (I != Idents.size() - 1)
1920-
OS << ", ";
1921-
}
1922-
}
1915+
if (auto *attr = dyn_cast_or_null<LifetimeCaptureByAttr>(T->getAttr()))
1916+
llvm::interleaveComma(attr->getArgIdents(), OS,
1917+
[&](auto it) { OS << it->getName(); });
19231918
OS << ")]]";
19241919
return;
19251920
}

0 commit comments

Comments
 (0)