[llvm] [ADT] Deprecate StringSwitch Cases with 3+ args. NFC. (PR #165119)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 25 14:47:29 PDT 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.
3+ args is an arbitrary number that allows for incremental depreciation without having to update too many call sites.
For more context, see https://github.com/llvm/llvm-project/pull/163117.
---
Full diff: https://github.com/llvm/llvm-project/pull/165119.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/StringSwitch.h (+2)
``````````diff
diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 2262b1162e330..98685de8573fa 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -93,6 +93,7 @@ class StringSwitch {
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);
@@ -176,6 +177,7 @@ class StringSwitch {
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/165119
More information about the llvm-commits
mailing list