Skip to content

Commit 6aa443a

Browse files
committed
[ADT] Deprecate StringSwitch Cases with 3+ args. NFC.
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 llvm#163117.
1 parent f03ccef commit 6aa443a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/include/llvm/ADT/StringSwitch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class StringSwitch {
9393
return CasesImpl({S0, S1}, Value);
9494
}
9595

96+
[[deprecated("Pass cases in std::initializer_list instead")]]
9697
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
9798
T Value) {
9899
return CasesImpl({S0, S1, S2}, Value);
@@ -176,6 +177,7 @@ class StringSwitch {
176177
return CasesLowerImpl({S0, S1}, Value);
177178
}
178179

180+
[[deprecated("Pass cases in std::initializer_list instead")]]
179181
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
180182
T Value) {
181183
return CasesLowerImpl({S0, S1, S2}, Value);

0 commit comments

Comments
 (0)