forked from OSchip/llvm-project
Use StringSwtich::Cases for multiple choices.
llvm-svn: 282964
This commit is contained in:
parent
f74169c9d6
commit
c79ecdd876
|
@ -75,10 +75,8 @@ private:
|
|||
// Returns /machine's value.
|
||||
MachineTypes getMachineType(StringRef S) {
|
||||
MachineTypes MT = StringSwitch<MachineTypes>(S.lower())
|
||||
.Case("x64", AMD64)
|
||||
.Case("amd64", AMD64)
|
||||
.Case("x86", I386)
|
||||
.Case("i386", I386)
|
||||
.Cases("x64", "amd64", AMD64)
|
||||
.Cases("x86", "i386", I386)
|
||||
.Case("arm", ARMNT)
|
||||
.Default(IMAGE_FILE_MACHINE_UNKNOWN);
|
||||
if (MT != IMAGE_FILE_MACHINE_UNKNOWN)
|
||||
|
|
|
@ -852,10 +852,7 @@ OutputSection *Writer::createSection(StringRef Name) {
|
|||
uint32_t Perms = StringSwitch<uint32_t>(Name)
|
||||
.Case(".bss", BSS | R | W)
|
||||
.Case(".data", DATA | R | W)
|
||||
.Case(".didat", DATA | R)
|
||||
.Case(".edata", DATA | R)
|
||||
.Case(".idata", DATA | R)
|
||||
.Case(".rdata", DATA | R)
|
||||
.Cases(".didat", ".edata", ".idata", ".rdata", DATA | R)
|
||||
.Case(".reloc", DATA | DISCARDABLE | R)
|
||||
.Case(".text", CODE | R | X)
|
||||
.Default(0);
|
||||
|
|
|
@ -62,8 +62,7 @@ static std::pair<ELFKind, uint16_t> parseEmulation(StringRef Emul) {
|
|||
|
||||
std::pair<ELFKind, uint16_t> Ret =
|
||||
StringSwitch<std::pair<ELFKind, uint16_t>>(S)
|
||||
.Case("aarch64elf", {ELF64LEKind, EM_AARCH64})
|
||||
.Case("aarch64linux", {ELF64LEKind, EM_AARCH64})
|
||||
.Cases("aarch64elf", "aarch64linux", {ELF64LEKind, EM_AARCH64})
|
||||
.Case("armelf_linux_eabi", {ELF32LEKind, EM_ARM})
|
||||
.Case("elf32_x86_64", {ELF32LEKind, EM_X86_64})
|
||||
.Case("elf32btsmip", {ELF32BEKind, EM_MIPS})
|
||||
|
@ -72,10 +71,9 @@ static std::pair<ELFKind, uint16_t> parseEmulation(StringRef Emul) {
|
|||
.Case("elf64btsmip", {ELF64BEKind, EM_MIPS})
|
||||
.Case("elf64ltsmip", {ELF64LEKind, EM_MIPS})
|
||||
.Case("elf64ppc", {ELF64BEKind, EM_PPC64})
|
||||
.Case("elf_amd64", {ELF64LEKind, EM_X86_64})
|
||||
.Cases("elf_amd64", "elf_x86_64", {ELF64LEKind, EM_X86_64})
|
||||
.Case("elf_i386", {ELF32LEKind, EM_386})
|
||||
.Case("elf_iamcu", {ELF32LEKind, EM_IAMCU})
|
||||
.Case("elf_x86_64", {ELF64LEKind, EM_X86_64})
|
||||
.Default({ELFNoneKind, EM_NONE});
|
||||
|
||||
if (Ret.first == ELFNoneKind) {
|
||||
|
|
Loading…
Reference in New Issue