[llvm] [ADT] Remove deprecated variadic `StringSwitch::Cases` and `CasesLower` (PR #185191)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 06:04:56 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Jakub Kuderski (kuhar)

<details>
<summary>Changes</summary>

These overloads have been deprecated since October 2025.
Use the `std::initializer_list` overload instead: `.Cases({"a", "b"}, Value)`.

For more context, see https://github.com/llvm/llvm-project/pull/163117.

Assisted-by: claude

---
Full diff: https://github.com/llvm/llvm-project/pull/185191.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/StringSwitch.h (-83) 


``````````diff
diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 5da6076c27390..1500b306d8937 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -90,66 +90,6 @@ class StringSwitch {
     return CasesImpl(CaseStrings, Value);
   }
 
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, T Value) {
-    return CasesImpl({S0, S1}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      T Value) {
-    return CasesImpl({S0, S1, S2}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, T Value) {
-    return CasesImpl({S0, S1, S2, S3}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, StringLiteral S5,
-                      T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4, S5}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, StringLiteral S5,
-                      StringLiteral S6, T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4, S5, S6}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, StringLiteral S5,
-                      StringLiteral S6, StringLiteral S7, T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, StringLiteral S5,
-                      StringLiteral S6, StringLiteral S7, StringLiteral S8,
-                      T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7, S8}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                      StringLiteral S3, StringLiteral S4, StringLiteral S5,
-                      StringLiteral S6, StringLiteral S7, StringLiteral S8,
-                      StringLiteral S9, T Value) {
-    return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7, S8, S9}, Value);
-  }
-
   // Case-insensitive case matchers.
   StringSwitch &CaseLower(StringLiteral S, T Value) {
     CaseLowerImpl(S, Value);
@@ -175,29 +115,6 @@ class StringSwitch {
     return CasesLowerImpl(CaseStrings, Value);
   }
 
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, T Value) {
-    return CasesLowerImpl({S0, S1}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                           T Value) {
-    return CasesLowerImpl({S0, S1, S2}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                           StringLiteral S3, T Value) {
-    return CasesLowerImpl({S0, S1, S2, S3}, Value);
-  }
-
-  [[deprecated("Pass cases in std::initializer_list instead")]]
-  StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
-                           StringLiteral S3, StringLiteral S4, T Value) {
-    return CasesLowerImpl({S0, S1, S2, S3, S4}, Value);
-  }
-
   [[nodiscard]] R Default(T Value) {
     if (Result)
       return std::move(*Result);

``````````

</details>


https://github.com/llvm/llvm-project/pull/185191


More information about the llvm-commits mailing list