1414#define LLVM_ADT_STRINGSWITCH_H
1515
1616#include " llvm/ADT/StringRef.h"
17+ #include " llvm/Support/Compiler.h"
1718#include " llvm/Support/ErrorHandling.h"
1819#include < cassert>
1920#include < cstring>
@@ -38,7 +39,7 @@ namespace llvm {
3839// / .Case("green", Green)
3940// / .Case("blue", Blue)
4041// / .Case("indigo", Indigo)
41- // / .Cases("violet", "purple", Violet)
42+ // / .Cases({ "violet", "purple"} , Violet)
4243// / .Default(UnknownColor);
4344// / \endcode
4445template <typename T, typename R = T>
@@ -107,31 +108,36 @@ class StringSwitch {
107108 return CasesImpl (Value, {S0, S1, S2, S3, S4});
108109 }
109110
111+ [[deprecated(" Pass cases in std::initializer_list instead" )]]
110112 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
111113 StringLiteral S3, StringLiteral S4, StringLiteral S5,
112114 T Value) {
113115 return CasesImpl (Value, {S0, S1, S2, S3, S4, S5});
114116 }
115117
118+ [[deprecated(" Pass cases in std::initializer_list instead" )]]
116119 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
117120 StringLiteral S3, StringLiteral S4, StringLiteral S5,
118121 StringLiteral S6, T Value) {
119122 return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6});
120123 }
121124
125+ [[deprecated(" Pass cases in std::initializer_list instead" )]]
122126 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
123127 StringLiteral S3, StringLiteral S4, StringLiteral S5,
124128 StringLiteral S6, StringLiteral S7, T Value) {
125129 return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6, S7});
126130 }
127131
132+ [[deprecated(" Pass cases in std::initializer_list instead" )]]
128133 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
129134 StringLiteral S3, StringLiteral S4, StringLiteral S5,
130135 StringLiteral S6, StringLiteral S7, StringLiteral S8,
131136 T Value) {
132137 return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6, S7, S8});
133138 }
134139
140+ [[deprecated(" Pass cases in std::initializer_list instead" )]]
135141 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
136142 StringLiteral S3, StringLiteral S4, StringLiteral S5,
137143 StringLiteral S6, StringLiteral S7, StringLiteral S8,
0 commit comments