Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions clang/lib/Basic/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,10 @@ bool AArch64TargetInfo::validateCpuSupports(StringRef FeatureStr) const {

bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
return llvm::StringSwitch<bool>(Feature)
.Cases("aarch64", "arm64", "arm", true)
.Cases({"aarch64", "arm64", "arm"}, true)
.Case("fmv", HasFMV)
.Case("fp", FPU & FPUMode)
.Cases("neon", "simd", FPU & NeonMode)
.Cases({"neon", "simd"}, FPU & NeonMode)
.Case("jscvt", HasJSCVT)
.Case("fcma", HasFCMA)
.Case("rng", HasRandGen)
Expand All @@ -829,8 +829,8 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
.Case("cssc", HasCSSC)
.Case("sha2", HasSHA2)
.Case("sha3", HasSHA3)
.Cases("aes", "pmull", HasAES)
.Cases("fp16", "fullfp16", HasFullFP16)
.Cases({"aes", "pmull"}, HasAES)
.Cases({"fp16", "fullfp16"}, HasFullFP16)
.Case("dit", HasDIT)
.Case("dpb", HasCCPP)
.Case("dpb2", HasCCDP)
Expand Down Expand Up @@ -859,9 +859,9 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
.Case("memtag", HasMTE)
.Case("sb", HasSB)
.Case("predres", HasPredRes)
.Cases("ssbs", "ssbs2", HasSSBS)
.Cases({"ssbs", "ssbs2"}, HasSSBS)
.Case("bti", HasBTI)
.Cases("ls64", "ls64_v", "ls64_accdata", HasLS64)
.Cases({"ls64", "ls64_v", "ls64_accdata"}, HasLS64)
.Case("wfxt", HasWFxT)
.Case("rcpc3", HasRCPC3)
.Case("fp8", HasFP8)
Expand Down
30 changes: 15 additions & 15 deletions clang/lib/Basic/Targets/PPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,41 +122,41 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
.Case("970", ArchDefineName | ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
.Case("a2", ArchDefineA2)
.Cases("power3", "pwr3", ArchDefinePpcgr)
.Cases("power4", "pwr4",
.Cases({"power3", "pwr3"}, ArchDefinePpcgr)
.Cases({"power4", "pwr4"},
ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
.Cases("power5", "pwr5",
ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
.Cases("power5x", "pwr5x",
.Cases({"power5x", "pwr5x"},
ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
ArchDefinePpcgr | ArchDefinePpcsq)
.Cases("power6", "pwr6",
ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
.Cases("power6x", "pwr6x",
.Cases({"power6", "pwr6"}, ArchDefinePwr6 | ArchDefinePwr5x |
ArchDefinePwr5 | ArchDefinePwr4 |
ArchDefinePpcgr | ArchDefinePpcsq)
.Cases({"power6x", "pwr6x"},
ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x |
ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
.Cases("power7", "pwr7",
ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x |
ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
.Cases({"power7", "pwr7"}, ArchDefinePwr7 | ArchDefinePwr6 |
ArchDefinePwr5x | ArchDefinePwr5 |
ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
// powerpc64le automatically defaults to at least power8.
.Cases("power8", "pwr8", "ppc64le",
.Cases({"power8", "pwr8", "ppc64le"},
ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 |
ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
ArchDefinePpcgr | ArchDefinePpcsq)
.Cases("power9", "pwr9",
.Cases({"power9", "pwr9"},
ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 |
ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
.Cases("power10", "pwr10",
.Cases({"power10", "pwr10"},
ArchDefinePwr10 | ArchDefinePwr9 | ArchDefinePwr8 |
ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x |
ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
ArchDefinePpcsq)
.Cases("power11", "pwr11",
.Cases({"power11", "pwr11"},
ArchDefinePwr11 | ArchDefinePwr10 | ArchDefinePwr9 |
ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 |
ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
DashX = llvm::StringSwitch<InputKind>(XValue)
.Case("cpp-output", InputKind(Language::C).getPreprocessed())
.Case("assembler-with-cpp", Language::Asm)
.Cases("ast", "pcm", "precompiled-header",
.Cases({"ast", "pcm", "precompiled-header"},
InputKind(Language::Unknown, InputKind::Precompiled))
.Case("ir", Language::LLVM_IR)
.Case("cir", Language::CIR)
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Lex/LiteralSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,10 +1283,10 @@ bool NumericLiteralParser::isValidUDSuffix(const LangOptions &LangOpts,
// Per tweaked N3660, "il", "i", and "if" are also used in the library.
// In C++2a "d" and "y" are used in the library.
return llvm::StringSwitch<bool>(Suffix)
.Cases("h", "min", "s", true)
.Cases("ms", "us", "ns", true)
.Cases("il", "i", "if", true)
.Cases("d", "y", LangOpts.CPlusPlus20)
.Cases({"h", "min", "s"}, true)
.Cases({"ms", "us", "ns"}, true)
.Cases({"il", "i", "if"}, true)
.Cases({"d", "y"}, LangOpts.CPlusPlus20)
.Default(false);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TargetOptionsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool TargetOptions::FramePointerIsReserved(const MachineFunction &MF) const {
return false;

return StringSwitch<bool>(FPAttr.getValueAsString())
.Cases("all", "non-leaf", "reserved", true)
.Cases({"all", "non-leaf", "reserved"}, true)
.Case("none", false);
}

Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/MC/MCParser/MasmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5844,11 +5844,11 @@ bool MasmParser::lookUpField(const StructInfo &Structure, StringRef Member,

bool MasmParser::lookUpType(StringRef Name, AsmTypeInfo &Info) const {
unsigned Size = StringSwitch<unsigned>(Name)
.CasesLower("byte", "db", "sbyte", 1)
.CasesLower("word", "dw", "sword", 2)
.CasesLower("dword", "dd", "sdword", 4)
.CasesLower("fword", "df", 6)
.CasesLower("qword", "dq", "sqword", 8)
.CasesLower({"byte", "db", "sbyte"}, 1)
.CasesLower({"word", "dw", "sword"}, 2)
.CasesLower({"dword", "dd", "sdword"}, 4)
.CasesLower({"fword", "df"}, 6)
.CasesLower({"qword", "dq", "sqword"}, 8)
.CaseLower("real4", 4)
.CaseLower("real8", 8)
.CaseLower("real10", 10)
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3533,10 +3533,10 @@ bool X86AsmParser::parseInstruction(ParseInstructionInfo &Info, StringRef Name,
while (isLockRepeatNtPrefix(Name.lower())) {
unsigned Prefix =
StringSwitch<unsigned>(Name)
.Cases("lock", "lock", X86::IP_HAS_LOCK)
.Cases("rep", "repe", "repz", X86::IP_HAS_REPEAT)
.Cases("repne", "repnz", X86::IP_HAS_REPEAT_NE)
.Cases("notrack", "notrack", X86::IP_HAS_NOTRACK)
.Case("lock", X86::IP_HAS_LOCK)
.Cases({"rep", "repe", "repz"}, X86::IP_HAS_REPEAT)
.Cases({"repne", "repnz"}, X86::IP_HAS_REPEAT_NE)
.Case("notrack", X86::IP_HAS_NOTRACK)
.Default(X86::IP_NO_PREFIX); // Invalid prefix (impossible)
Flags |= Prefix;
if (getLexer().is(AsmToken::EndOfStatement)) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/tools/llvm-cov/llvm-cov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ int main(int argc, const char **argv) {
.Case("gcov", gcovMain)
.Case("report", reportMain)
.Case("show", showMain)
.Cases("-h", "-help", "--help", helpMain)
.Cases("-version", "--version", versionMain)
.Cases({"-h", "-help", "--help"}, helpMain)
.Cases({"-version", "--version"}, versionMain)
.Default(nullptr);

if (Func) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/ADT/StringSwitchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ TEST(StringSwitchTest, Cases) {

auto Translate = [](StringRef S) {
return llvm::StringSwitch<OSType>(S)
.Cases(StringLiteral::withInnerNUL("wind\0ws"), "win32", "winnt",
.Cases({StringLiteral::withInnerNUL("wind\0ws"), "win32", "winnt"},
OSType::Windows)
.Cases({"linux", "unix", "*nix", "posix"}, OSType::Linux)
.Cases({"macos", "osx"}, OSType::MacOS)
Expand Down Expand Up @@ -189,7 +189,7 @@ TEST(StringSwitchTest, CasesLower) {

auto Translate = [](StringRef S) {
return llvm::StringSwitch<OSType>(S)
.CasesLower(StringLiteral::withInnerNUL("wind\0ws"), "win32", "winnt",
.CasesLower({StringLiteral::withInnerNUL("wind\0ws"), "win32", "winnt"},
OSType::Windows)
.CasesLower({"linux", "unix", "*nix", "posix"}, OSType::Linux)
.CasesLower({"macos", "osx"}, OSType::MacOS)
Expand Down