[llvm] [ADT] Deprecate variadic `StringSwitch::Cases`. NFC. (PR #166066)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 2 04:42:05 PST 2025


https://github.com/kuhar created https://github.com/llvm/llvm-project/pull/166066

Suggest the initializer_list overload instead.

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

>From 176a5568f94cd61943817969d2e7ed83477f77ee Mon Sep 17 00:00:00 2001
From: Jakub Kuderski <jakub at nod-labs.com>
Date: Sun, 2 Nov 2025 07:41:04 -0500
Subject: [PATCH] [ADT] Ddeprecate variadic StringSwitch::Cases. NFC.

---
 llvm/include/llvm/ADT/StringSwitch.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 486815328ead7..8c8d31bd4f055 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -89,6 +89,7 @@ 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);
   }



More information about the llvm-commits mailing list