[lld] r336815 - [ELF] - Simplify code. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 08:23:34 PDT 2018
Author: grimar
Date: Wed Jul 11 08:23:33 2018
New Revision: 336815
URL: http://llvm.org/viewvc/llvm-project?rev=336815&view=rev
Log:
[ELF] - Simplify code. NFC.
This looks a bit simpler IMO.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=336815&r1=336814&r2=336815&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Jul 11 08:23:33 2018
@@ -1441,16 +1441,13 @@ template <class ELFT> void Writer<ELFT>:
// previous one. This does not require any rewriting of InputSection
// contents but misses opportunities for fine grained deduplication
// where only a subset of the InputSection contents can be merged.
- int Cur = 1;
- int Prev = 0;
+ size_t Prev = 0;
// The last one is a sentinel entry which should not be removed.
- int N = Sections.size() - 1;
- while (Cur < N) {
- if (isDuplicateArmExidxSec(Sections[Prev], Sections[Cur]))
- Sections[Cur] = nullptr;
+ for (size_t I = 1; I < Sections.size() - 1; ++I) {
+ if (isDuplicateArmExidxSec(Sections[Prev], Sections[I]))
+ Sections[I] = nullptr;
else
- Prev = Cur;
- ++Cur;
+ Prev = I;
}
}
}
More information about the llvm-commits
mailing list