diff options
| author | Rui Ueyama <ruiu@google.com> | 2017-10-27 04:15:28 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2017-10-27 04:15:28 +0000 |
| commit | f9c66e4b80038d4c079515f7ea884d6d9a3d848a (patch) | |
| tree | 132302bb0b515c50525ed1fa3b3cb13f4f59190a | |
| parent | 57d46b843687b61758ae4dc7045df5dced61e937 (diff) | |
| download | bcm5719-llvm-f9c66e4b80038d4c079515f7ea884d6d9a3d848a.tar.gz bcm5719-llvm-f9c66e4b80038d4c079515f7ea884d6d9a3d848a.zip | |
Remove a boolean flag `Create`. NFC.
llvm-svn: 316738
| -rw-r--r-- | lld/ELF/SyntheticSections.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index f1cd32d595f..5870448f8b3 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -198,14 +198,17 @@ MipsOptionsSection<ELFT> *MipsOptionsSection<ELFT>::create() { if (!ELFT::Is64Bits) return nullptr; - Elf_Mips_RegInfo Reginfo = {}; - bool Create = false; + std::vector<InputSectionBase *> Sections; + for (InputSectionBase *Sec : InputSections) + if (Sec->Type == SHT_MIPS_OPTIONS) + Sections.push_back(Sec); - for (InputSectionBase *Sec : InputSections) { - if (Sec->Type != SHT_MIPS_OPTIONS) - continue; + if (Sections.empty()) + return nullptr; + + Elf_Mips_RegInfo Reginfo = {}; + for (InputSectionBase *Sec : Sections) { Sec->Live = false; - Create = true; std::string Filename = toString(Sec->File); ArrayRef<uint8_t> D = Sec->Data; @@ -231,9 +234,7 @@ MipsOptionsSection<ELFT> *MipsOptionsSection<ELFT>::create() { } }; - if (Create) - return make<MipsOptionsSection<ELFT>>(Reginfo); - return nullptr; + return make<MipsOptionsSection<ELFT>>(Reginfo); } // MIPS .reginfo section. @@ -256,14 +257,17 @@ MipsReginfoSection<ELFT> *MipsReginfoSection<ELFT>::create() { if (ELFT::Is64Bits) return nullptr; - Elf_Mips_RegInfo Reginfo = {}; - bool Create = false; + std::vector<InputSectionBase *> Sections; + for (InputSectionBase *Sec : InputSections) + if (Sec->Type == SHT_MIPS_REGINFO) + Sections.push_back(Sec); - for (InputSectionBase *Sec : InputSections) { - if (Sec->Type != SHT_MIPS_REGINFO) - continue; + if (Sections.empty()) + return nullptr; + + Elf_Mips_RegInfo Reginfo = {}; + for (InputSectionBase *Sec : Sections) { Sec->Live = false; - Create = true; if (Sec->Data.size() != sizeof(Elf_Mips_RegInfo)) { error(toString(Sec->File) + ": invalid size of .reginfo section"); @@ -277,9 +281,7 @@ MipsReginfoSection<ELFT> *MipsReginfoSection<ELFT>::create() { Sec->getFile<ELFT>()->MipsGp0 = R->ri_gp_value; }; - if (Create) - return make<MipsReginfoSection<ELFT>>(Reginfo); - return nullptr; + return make<MipsReginfoSection<ELFT>>(Reginfo); } InputSection *elf::createInterpSection() { |

