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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Jakub Kuderski (kuhar)

<details>
<summary>Changes</summary>

Suggest the initializer_list overload instead.

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

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


1 Files Affected:

- (modified) llvm/include/llvm/ADT/StringSwitch.h (+1) 


``````````diff
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);
   }

``````````

</details>


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


More information about the llvm-commits mailing list