summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-09-30 01:40:08 +0000
committerRui Ueyama <ruiu@google.com>2015-09-30 01:40:08 +0000
commit5ba3ac4f1085b5ac21f9adb27f9d10d4dd317db0 (patch)
tree17cbcea65b0c9a8532f5bda21dd65c13dc4c2e6c
parentaae9e1f2bd868741e5ce723540b18f1ec0921b08 (diff)
downloadbcm5719-llvm-5ba3ac4f1085b5ac21f9adb27f9d10d4dd317db0.tar.gz
bcm5719-llvm-5ba3ac4f1085b5ac21f9adb27f9d10d4dd317db0.zip
Simplify switch statements. NFC.
llvm-svn: 248871
-rw-r--r--lld/ELF/Target.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index dae8ba5e73d..3e1f48e8534 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -46,14 +46,7 @@ void X86TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr,
}
bool X86TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
- if (relocNeedsPlt(Type, S))
- return true;
- switch (Type) {
- default:
- return false;
- case R_386_GOT32:
- return true;
- }
+ return Type == R_386_GOT32 || relocNeedsPlt(Type, S);
}
bool X86TargetInfo::relocPointsToGot(uint32_t Type) const {
@@ -61,12 +54,7 @@ bool X86TargetInfo::relocPointsToGot(uint32_t Type) const {
}
bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
- switch (Type) {
- default:
- return false;
- case R_386_PLT32:
- return true;
- }
+ return Type == R_386_PLT32;
}
static void add32le(uint8_t *P, int32_t V) { write32le(P, read32le(P) + V); }
@@ -114,14 +102,7 @@ void X86_64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr,
}
bool X86_64TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
- if (relocNeedsPlt(Type, S))
- return true;
- switch (Type) {
- default:
- return false;
- case R_X86_64_GOTPCREL:
- return true;
- }
+ return Type == R_X86_64_GOTPCREL || relocNeedsPlt(Type, S);
}
bool X86_64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
OpenPOWER on IntegriCloud