From 4831d92005c1332ca4b2a7d7c608071dab20f256 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 18 Aug 2025 22:39:45 -0700 Subject: [PATCH] [lld] Replace SmallSet with SmallPtrSet (NFC) (#154263) This patch replaces SmallSet with SmallPtrSet. Note that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer element types: template class SmallSet : public SmallPtrSet {}; 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. --- lld/ELF/Relocations.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 9cb0460a2dac..6f55bac2ecf1 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -273,12 +273,12 @@ template static bool isReadOnly(SharedSymbol &ss) { // them are copied by a copy relocation, all of them need to be copied. // Otherwise, they would refer to different places at runtime. template -static SmallSet getSymbolsAt(Ctx &ctx, SharedSymbol &ss) { +static SmallPtrSet getSymbolsAt(Ctx &ctx, SharedSymbol &ss) { using Elf_Sym = typename ELFT::Sym; const auto &file = cast(*ss.file); - SmallSet ret; + SmallPtrSet ret; for (const Elf_Sym &s : file.template getGlobalELFSyms()) { if (s.st_shndx == SHN_UNDEF || s.st_shndx == SHN_ABS || s.getType() == STT_TLS || s.st_value != ss.value)