Skip to content

Commit 4831d92

Browse files
[lld] Replace SmallSet with SmallPtrSet (NFC) (#154263)
This patch replaces SmallSet<T *, N> with SmallPtrSet<T *, N>. Note that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer element types: template <typename PointeeType, unsigned N> class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; We only have 30 instances that rely on this "redirection". Since the redirection doesn't improve readability, this patch replaces SmallSet with SmallPtrSet for pointer element types. I'm planning to remove the redirection eventually.
1 parent d82617d commit 4831d92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lld/ELF/Relocations.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ template <class ELFT> static bool isReadOnly(SharedSymbol &ss) {
273273
// them are copied by a copy relocation, all of them need to be copied.
274274
// Otherwise, they would refer to different places at runtime.
275275
template <class ELFT>
276-
static SmallSet<SharedSymbol *, 4> getSymbolsAt(Ctx &ctx, SharedSymbol &ss) {
276+
static SmallPtrSet<SharedSymbol *, 4> getSymbolsAt(Ctx &ctx, SharedSymbol &ss) {
277277
using Elf_Sym = typename ELFT::Sym;
278278

279279
const auto &file = cast<SharedFile>(*ss.file);
280280

281-
SmallSet<SharedSymbol *, 4> ret;
281+
SmallPtrSet<SharedSymbol *, 4> ret;
282282
for (const Elf_Sym &s : file.template getGlobalELFSyms<ELFT>()) {
283283
if (s.st_shndx == SHN_UNDEF || s.st_shndx == SHN_ABS ||
284284
s.getType() == STT_TLS || s.st_value != ss.value)

0 commit comments

Comments
 (0)