Skip to content

Commit 294ba71

Browse files
kuhargithub-actions[bot]
authored andcommitted
Automerge: [ADT] Deprecate StringSwitch Cases with 4+ args. NFC. (#164276)
Suggest the `initializer_list` overload instead. 4+ args is an arbitrary number that allows for incremental deprecation without having too update too many call sites. For more context, see llvm/llvm-project#163117.
2 parents 78dbf5f + 894eaf4 commit 294ba71

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/include/llvm/ADT/StringSwitch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,13 @@ class StringSwitch {
9898
return CasesImpl({S0, S1, S2}, Value);
9999
}
100100

101+
[[deprecated("Pass cases in std::initializer_list instead")]]
101102
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
102103
StringLiteral S3, T Value) {
103104
return CasesImpl({S0, S1, S2, S3}, Value);
104105
}
105106

107+
[[deprecated("Pass cases in std::initializer_list instead")]]
106108
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
107109
StringLiteral S3, StringLiteral S4, T Value) {
108110
return CasesImpl({S0, S1, S2, S3, S4}, Value);
@@ -179,11 +181,13 @@ class StringSwitch {
179181
return CasesLowerImpl({S0, S1, S2}, Value);
180182
}
181183

184+
[[deprecated("Pass cases in std::initializer_list instead")]]
182185
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
183186
StringLiteral S3, T Value) {
184187
return CasesLowerImpl({S0, S1, S2, S3}, Value);
185188
}
186189

190+
[[deprecated("Pass cases in std::initializer_list instead")]]
187191
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
188192
StringLiteral S3, StringLiteral S4, T Value) {
189193
return CasesLowerImpl({S0, S1, S2, S3, S4}, Value);

0 commit comments

Comments
 (0)