diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 575a5afb84c1..176039d5949c 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2765,13 +2765,13 @@ readAddressAreas(DWARFContext &dwarf, InputSection *sec) { } template -static std::vector +static SmallVector readPubNamesAndTypes(const LLDDwarfObj &obj, const SmallVectorImpl &cus) { const LLDDWARFSection &pubNames = obj.getGnuPubnamesSection(); const LLDDWARFSection &pubTypes = obj.getGnuPubtypesSection(); - std::vector ret; + SmallVector ret; for (const LLDDWARFSection *pub : {&pubNames, &pubTypes}) { DWARFDataExtractor data(obj, *pub, config->isLE, config->wordsize); DWARFDebugPubTable table; @@ -2798,9 +2798,9 @@ readPubNamesAndTypes(const LLDDwarfObj &obj, // Create a list of symbols from a given list of symbol names and types // by uniquifying them by name. -static std::vector -createSymbols(ArrayRef> nameAttrs, - const std::vector &chunks) { +static SmallVector createSymbols( + ArrayRef> nameAttrs, + const SmallVector &chunks) { using GdbSymbol = GdbIndexSection::GdbSymbol; using NameAttrEntry = GdbIndexSection::NameAttrEntry; @@ -2827,7 +2827,7 @@ createSymbols(ArrayRef> nameAttrs, size_t shift = 32 - countTrailingZeros(numShards); // Instantiate GdbSymbols while uniqufying them by name. - auto symbols = std::make_unique[]>(numShards); + auto symbols = std::make_unique[]>(numShards); parallelForEachN(0, concurrency, [&](size_t threadId) { uint32_t i = 0; @@ -2857,9 +2857,9 @@ createSymbols(ArrayRef> nameAttrs, // The return type is a flattened vector, so we'll copy each vector // contents to Ret. - std::vector ret; + SmallVector ret; ret.reserve(numSymbols); - for (std::vector &vec : + for (SmallVector &vec : makeMutableArrayRef(symbols.get(), numShards)) for (GdbSymbol &sym : vec) ret.push_back(std::move(sym)); @@ -2906,8 +2906,8 @@ template GdbIndexSection *GdbIndexSection::create() { return !s->isLive(); }); - std::vector chunks(files.size()); - std::vector> nameAttrs(files.size()); + SmallVector chunks(files.size()); + SmallVector, 0> nameAttrs(files.size()); parallelForEachN(0, files.size(), [&](size_t i) { // To keep memory usage low, we don't want to keep cached DWARFContext, so diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 410639128e07..4d42c72ae9f4 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -820,10 +820,10 @@ private: // Each chunk contains information gathered from debug sections of a // single object file. - std::vector chunks; + SmallVector chunks; // A symbol table for this .gdb_index section. - std::vector symbols; + SmallVector symbols; size_t size; };