[llvm] r359301 - [yaml2obj] - Make implicitSectionNames() return std::vector<StringRef>. NFCI.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 06:09:11 PDT 2019
Author: grimar
Date: Fri Apr 26 06:09:11 2019
New Revision: 359301
URL: http://llvm.org/viewvc/llvm-project?rev=359301&view=rev
Log:
[yaml2obj] - Make implicitSectionNames() return std::vector<StringRef>. NFCI.
No need to use SmallVector of char* here.
This simplifies the code.
Modified:
llvm/trunk/tools/yaml2obj/yaml2elf.cpp
Modified: llvm/trunk/tools/yaml2obj/yaml2elf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2elf.cpp?rev=359301&r1=359300&r2=359301&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2elf.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2elf.cpp Fri Apr 26 06:09:11 2019
@@ -170,7 +170,7 @@ class ELFState {
bool writeSectionContent(Elf_Shdr &SHeader,
const ELFYAML::DynamicSection &Section,
ContiguousBlobAccumulator &CBA);
- SmallVector<const char *, 5> implicitSectionNames() const;
+ std::vector<StringRef> 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 <class ELFT> bool ELFState<ELFT
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<ELFT>::writeELF(raw_ostream
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<ELFT>::writeELF(raw_ostream
}
template <class ELFT>
-SmallVector<const char *, 5> ELFState<ELFT>::implicitSectionNames() const {
+std::vector<StringRef> ELFState<ELFT>::implicitSectionNames() const {
if (Doc.DynamicSymbols.empty())
return {".symtab", ".strtab", ".shstrtab"};
return {".symtab", ".strtab", ".shstrtab", ".dynsym", ".dynstr"};
More information about the llvm-commits
mailing list