[lld] r299512 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 22:06:38 PDT 2017
Author: ruiu
Date: Wed Apr 5 00:06:37 2017
New Revision: 299512
URL: http://llvm.org/viewvc/llvm-project?rev=299512&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=299512&r1=299511&r2=299512&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Apr 5 00:06:37 2017
@@ -940,22 +940,16 @@ uint32_t LinkerScript::getFiller(StringR
}
static void writeInt(uint8_t *Buf, uint64_t Data, uint64_t Size) {
- switch (Size) {
- case 1:
- *Buf = (uint8_t)Data;
- break;
- case 2:
+ if (Size == 1)
+ *Buf = Data;
+ else if (Size == 2)
write16(Buf, Data, Config->Endianness);
- break;
- case 4:
+ else if (Size == 4)
write32(Buf, Data, Config->Endianness);
- break;
- case 8:
+ else if (Size == 8)
write64(Buf, Data, Config->Endianness);
- break;
- default:
+ else
llvm_unreachable("unsupported Size argument");
- }
}
void LinkerScript::writeDataBytes(StringRef Name, uint8_t *Buf) {
More information about the llvm-commits
mailing list