Skip to content

Commit a92eb06

Browse files
svenvhjsji
authored andcommitted
Update for StringSwitch::Cases deprecation; NFC (#3407)
Use the `.Cases({S0, S1, ...}, Value)` overloads instead. Original commit: KhronosGroup/SPIRV-LLVM-Translator@35827fe27aeaa49
1 parent ea12288 commit a92eb06

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

llvm-spirv/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);

llvm-spirv/lib/SPIRV/SPIRVUtil.cpp

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

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5369,16 +5369,16 @@ LLVMToSPIRVBase::getFPBuiltinType(IntrinsicInst *II, StringRef &OpName) {
53695369
OpName = Name.split('.').first;
53705370
FPBuiltinType Type =
53715371
StringSwitch<FPBuiltinType>(OpName)
5372-
.Cases("fadd", "fsub", "fmul", "fdiv", "frem",
5372+
.Cases({"fadd", "fsub", "fmul", "fdiv", "frem"},
53735373
FPBuiltinType::REGULAR_MATH)
5374-
.Cases("sin", "cos", "tan", FPBuiltinType::EXT_1OPS)
5375-
.Cases("sinh", "cosh", "tanh", FPBuiltinType::EXT_1OPS)
5376-
.Cases("asin", "acos", "atan", FPBuiltinType::EXT_1OPS)
5377-
.Cases("asinh", "acosh", "atanh", FPBuiltinType::EXT_1OPS)
5378-
.Cases("exp", "exp2", "exp10", "expm1", FPBuiltinType::EXT_1OPS)
5379-
.Cases("log", "log2", "log10", "log1p", FPBuiltinType::EXT_1OPS)
5380-
.Cases("sqrt", "rsqrt", "erf", "erfc", FPBuiltinType::EXT_1OPS)
5381-
.Cases("atan2", "pow", "hypot", "ldexp", FPBuiltinType::EXT_2OPS)
5374+
.Cases({"sin", "cos", "tan"}, FPBuiltinType::EXT_1OPS)
5375+
.Cases({"sinh", "cosh", "tanh"}, FPBuiltinType::EXT_1OPS)
5376+
.Cases({"asin", "acos", "atan"}, FPBuiltinType::EXT_1OPS)
5377+
.Cases({"asinh", "acosh", "atanh"}, FPBuiltinType::EXT_1OPS)
5378+
.Cases({"exp", "exp2", "exp10", "expm1"}, FPBuiltinType::EXT_1OPS)
5379+
.Cases({"log", "log2", "log10", "log1p"}, FPBuiltinType::EXT_1OPS)
5380+
.Cases({"sqrt", "rsqrt", "erf", "erfc"}, FPBuiltinType::EXT_1OPS)
5381+
.Cases({"atan2", "pow", "hypot", "ldexp"}, FPBuiltinType::EXT_2OPS)
53825382
.Case("sincos", FPBuiltinType::EXT_3OPS)
53835383
.Default(FPBuiltinType::UNKNOWN);
53845384
return Type;

0 commit comments

Comments
 (0)