From: George Rimar Date: Fri, 26 Apr 2019 13:09:11 +0000 (+0000) Subject: [yaml2obj] - Make implicitSectionNames() return std::vector. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c64c7b7cce2b2f2af249c5d6e16140b23461681;p=llvm [yaml2obj] - Make implicitSectionNames() return std::vector. NFCI. No need to use SmallVector of char* here. This simplifies the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359301 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index bb5ca4ce86a..1f83656a606 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -170,7 +170,7 @@ class ELFState { bool writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::DynamicSection &Section, ContiguousBlobAccumulator &CBA); - SmallVector implicitSectionNames() const; + std::vector implicitSectionNames() const; // - SHT_NULL entry (placed first, i.e. 0'th entry) // - symbol table (.symtab) (defaults to after last yaml section) @@ -792,7 +792,7 @@ template bool ELFState::buildSectionIndex() { auto SecNo = 1 + Doc.Sections.size(); // Add special sections after input sections, if necessary. - for (const auto &Name : implicitSectionNames()) + for (StringRef Name : implicitSectionNames()) if (!SN2I.addName(Name, SecNo)) { // Account for this section, since it wasn't in the Doc ++SecNo; @@ -894,7 +894,7 @@ int ELFState::writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { return 1; // Populate SHeaders with implicit sections not present in the Doc - for (const auto &Name : State.implicitSectionNames()) + for (StringRef Name : State.implicitSectionNames()) if (State.SN2I.get(Name) >= SHeaders.size()) SHeaders.push_back({}); @@ -925,7 +925,7 @@ int ELFState::writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { } template -SmallVector ELFState::implicitSectionNames() const { +std::vector ELFState::implicitSectionNames() const { if (Doc.DynamicSymbols.empty()) return {".symtab", ".strtab", ".shstrtab"}; return {".symtab", ".strtab", ".shstrtab", ".dynsym", ".dynstr"};