Skip to content

Commit 8af44b0

Browse files
[Support] Use a C++17 fold expression in ScopedPrinter.h (NFC) (#161778)
1 parent 2689aba commit 8af44b0

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

llvm/include/llvm/Support/ScopedPrinter.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ class LLVM_ABI ScopedPrinter {
284284
startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
285285
}
286286

287-
template <typename... T> void printVersion(StringRef Label, T... Version) {
287+
template <typename T, typename... TArgs>
288+
void printVersion(StringRef Label, T MajorVersion, TArgs... MinorVersions) {
288289
startLine() << Label << ": ";
289-
printVersionInternal(Version...);
290+
getOStream() << MajorVersion;
291+
((getOStream() << '.' << MinorVersions), ...);
290292
getOStream() << "\n";
291293
}
292294

@@ -454,16 +456,6 @@ class LLVM_ABI ScopedPrinter {
454456
virtual raw_ostream &getOStream() { return OS; }
455457

456458
private:
457-
template <typename T> void printVersionInternal(T Value) {
458-
getOStream() << Value;
459-
}
460-
461-
template <typename S, typename T, typename... TArgs>
462-
void printVersionInternal(S Value, T Value2, TArgs... Args) {
463-
getOStream() << Value << ".";
464-
printVersionInternal(Value2, Args...);
465-
}
466-
467459
static bool flagName(const FlagEntry &LHS, const FlagEntry &RHS) {
468460
return LHS.Name < RHS.Name;
469461
}

0 commit comments

Comments
 (0)