[lld] r248871 - Simplify switch statements. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 18:40:09 PDT 2015
Author: ruiu
Date: Tue Sep 29 20:40:08 2015
New Revision: 248871
URL: http://llvm.org/viewvc/llvm-project?rev=248871&view=rev
Log:
Simplify switch statements. NFC.
Modified:
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=248871&r1=248870&r2=248871&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Sep 29 20:40:08 2015
@@ -46,14 +46,7 @@ void X86TargetInfo::writePltEntry(uint8_
}
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(uin
}
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(uin
}
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 {
More information about the llvm-commits
mailing list