[llvm] 8af44b0 - [Support] Use a C++17 fold expression in ScopedPrinter.h (NFC) (#161778)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 23:47:09 PDT 2025
Author: Kazu Hirata
Date: 2025-10-03T23:47:06-07:00
New Revision: 8af44b07db315baf9819d3395ab9efc64b26af08
URL: https://github.com/llvm/llvm-project/commit/8af44b07db315baf9819d3395ab9efc64b26af08
DIFF: https://github.com/llvm/llvm-project/commit/8af44b07db315baf9819d3395ab9efc64b26af08.diff
LOG: [Support] Use a C++17 fold expression in ScopedPrinter.h (NFC) (#161778)
Added:
Modified:
llvm/include/llvm/Support/ScopedPrinter.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index a08cc8fd31fd2..94080e85a9048 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -284,9 +284,11 @@ class LLVM_ABI ScopedPrinter {
startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
}
- template <typename... T> void printVersion(StringRef Label, T... Version) {
+ template <typename T, typename... TArgs>
+ void printVersion(StringRef Label, T MajorVersion, TArgs... MinorVersions) {
startLine() << Label << ": ";
- printVersionInternal(Version...);
+ getOStream() << MajorVersion;
+ ((getOStream() << '.' << MinorVersions), ...);
getOStream() << "\n";
}
@@ -454,16 +456,6 @@ class LLVM_ABI ScopedPrinter {
virtual raw_ostream &getOStream() { return OS; }
private:
- template <typename T> void printVersionInternal(T Value) {
- getOStream() << Value;
- }
-
- template <typename S, typename T, typename... TArgs>
- void printVersionInternal(S Value, T Value2, TArgs... Args) {
- getOStream() << Value << ".";
- printVersionInternal(Value2, Args...);
- }
-
static bool flagName(const FlagEntry &LHS, const FlagEntry &RHS) {
return LHS.Name < RHS.Name;
}
More information about the llvm-commits
mailing list