From bdaffd6c6bb6f82ffe76fdfb0394c050c9a9b9a8 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 11 Jul 2018 15:23:33 +0000 Subject: [PATCH] [ELF] - Simplify code. NFC. This looks a bit simpler IMO. llvm-svn: 336815 --- lld/ELF/Writer.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 2f58be5..08d9538 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1441,16 +1441,13 @@ template void Writer::resolveShfLinkOrder() { // 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; } } } -- 2.7.4