[lld] r316486 - Simplify.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 12:40:03 PDT 2017
Author: ruiu
Date: Tue Oct 24 12:40:03 2017
New Revision: 316486
URL: http://llvm.org/viewvc/llvm-project?rev=316486&view=rev
Log:
Simplify.
Modified:
lld/trunk/ELF/Arch/AMDGPU.cpp
Modified: lld/trunk/ELF/Arch/AMDGPU.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/AMDGPU.cpp?rev=316486&r1=316485&r2=316486&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/AMDGPU.cpp (original)
+++ lld/trunk/ELF/Arch/AMDGPU.cpp Tue Oct 24 12:40:03 2017
@@ -38,21 +38,21 @@ AMDGPU::AMDGPU() {
GotEntrySize = 8;
}
-uint32_t AMDGPU::calcEFlags() const {
- if (ObjectFiles.empty())
- return 0;
+static uint32_t getEFlags(InputFile *File) {
+ return cast<ObjFile<ELF64LE>>(File)->getObj().getHeader()->e_flags;
+}
- uint32_t Ret =
- cast<ObjFile<ELF64LE>>(ObjectFiles.front())->getObj().getHeader()->e_flags;
+uint32_t AMDGPU::calcEFlags() const {
+ assert(!ObjectFiles.empty());
+ uint32_t Ret = getEFlags(ObjectFiles[0]);
// Verify that all input files have the same e_flags.
- for (InputFile *F : ArrayRef<InputFile*>(ObjectFiles).slice(1)) {
- if (Ret != cast<ObjFile<ELF64LE>>(F)->getObj().getHeader()->e_flags) {
- error("incompatible e_flags: " + toString(F));
- return 0;
- }
+ for (InputFile *F : makeArrayRef(ObjectFiles).slice(1)) {
+ if (Ret == getEFlags(F))
+ continue;
+ error("incompatible e_flags: " + toString(F));
+ return 0;
}
-
return Ret;
}
More information about the llvm-commits
mailing list