Skip to content

Commit 35827fe

Browse files
authored
Update for StringSwitch::Cases deprecation; NFC (#3407)
Use the `.Cases({S0, S1, ...}, Value)` overloads instead.
1 parent c11cd5b commit 35827fe

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lib/SPIRV/OCLToSPIRV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ using namespace OCLUtil;
6464
namespace SPIRV {
6565
static size_t getOCLCpp11AtomicMaxNumOps(StringRef Name) {
6666
return StringSwitch<size_t>(Name)
67-
.Cases("load", "flag_test_and_set", "flag_clear", 3)
68-
.Cases("store", "exchange", 4)
67+
.Cases({"load", "flag_test_and_set", "flag_clear"}, 3)
68+
.Cases({"store", "exchange"}, 4)
6969
.StartsWith("compare_exchange", 6)
7070
.StartsWith("fetch", 4)
7171
.Default(0);

lib/SPIRV/SPIRVUtil.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,11 @@ static std::string demangleBuiltinOpenCLTypeName(StringRef MangledStructName) {
620620
/// floating point type.
621621
static Type *parsePrimitiveType(LLVMContext &Ctx, StringRef Name) {
622622
return StringSwitch<Type *>(Name)
623-
.Cases("char", "signed char", "unsigned char", Type::getInt8Ty(Ctx))
624-
.Cases("short", "unsigned short", Type::getInt16Ty(Ctx))
625-
.Cases("int", "unsigned int", Type::getInt32Ty(Ctx))
626-
.Cases("long", "unsigned long", Type::getInt64Ty(Ctx))
627-
.Cases("long long", "unsigned long long", Type::getInt64Ty(Ctx))
623+
.Cases({"char", "signed char", "unsigned char"}, Type::getInt8Ty(Ctx))
624+
.Cases({"short", "unsigned short"}, Type::getInt16Ty(Ctx))
625+
.Cases({"int", "unsigned int"}, Type::getInt32Ty(Ctx))
626+
.Cases({"long", "unsigned long"}, Type::getInt64Ty(Ctx))
627+
.Cases({"long long", "unsigned long long"}, Type::getInt64Ty(Ctx))
628628
.Case("half", Type::getHalfTy(Ctx))
629629
.Case("float", Type::getFloatTy(Ctx))
630630
.Case("double", Type::getDoubleTy(Ctx))

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5342,16 +5342,16 @@ LLVMToSPIRVBase::getFPBuiltinType(IntrinsicInst *II, StringRef &OpName) {
53425342
OpName = Name.split('.').first;
53435343
FPBuiltinType Type =
53445344
StringSwitch<FPBuiltinType>(OpName)
5345-
.Cases("fadd", "fsub", "fmul", "fdiv", "frem",
5345+
.Cases({"fadd", "fsub", "fmul", "fdiv", "frem"},
53465346
FPBuiltinType::REGULAR_MATH)
5347-
.Cases("sin", "cos", "tan", FPBuiltinType::EXT_1OPS)
5348-
.Cases("sinh", "cosh", "tanh", FPBuiltinType::EXT_1OPS)
5349-
.Cases("asin", "acos", "atan", FPBuiltinType::EXT_1OPS)
5350-
.Cases("asinh", "acosh", "atanh", FPBuiltinType::EXT_1OPS)
5351-
.Cases("exp", "exp2", "exp10", "expm1", FPBuiltinType::EXT_1OPS)
5352-
.Cases("log", "log2", "log10", "log1p", FPBuiltinType::EXT_1OPS)
5353-
.Cases("sqrt", "rsqrt", "erf", "erfc", FPBuiltinType::EXT_1OPS)
5354-
.Cases("atan2", "pow", "hypot", "ldexp", FPBuiltinType::EXT_2OPS)
5347+
.Cases({"sin", "cos", "tan"}, FPBuiltinType::EXT_1OPS)
5348+
.Cases({"sinh", "cosh", "tanh"}, FPBuiltinType::EXT_1OPS)
5349+
.Cases({"asin", "acos", "atan"}, FPBuiltinType::EXT_1OPS)
5350+
.Cases({"asinh", "acosh", "atanh"}, FPBuiltinType::EXT_1OPS)
5351+
.Cases({"exp", "exp2", "exp10", "expm1"}, FPBuiltinType::EXT_1OPS)
5352+
.Cases({"log", "log2", "log10", "log1p"}, FPBuiltinType::EXT_1OPS)
5353+
.Cases({"sqrt", "rsqrt", "erf", "erfc"}, FPBuiltinType::EXT_1OPS)
5354+
.Cases({"atan2", "pow", "hypot", "ldexp"}, FPBuiltinType::EXT_2OPS)
53555355
.Case("sincos", FPBuiltinType::EXT_3OPS)
53565356
.Default(FPBuiltinType::UNKNOWN);
53575357
return Type;

0 commit comments

Comments
 (0)