[llvm] [llvm-symbolizer] nfc, use map instead of vector (PR #69552)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 00:18:48 PDT 2023


================
@@ -82,12 +82,8 @@ class SymbolizableObjectFile : public SymbolizableModule {
     // Non-zero if this is an ELF local symbol. See the comment in
     // getNameFromSymbolTable.
     uint32_t ELFLocalSymIdx;
-
-    bool operator<(const SymbolDesc &RHS) const {
-      return Addr != RHS.Addr ? Addr < RHS.Addr : Size < RHS.Size;
-    }
   };
-  std::vector<SymbolDesc> Symbols;
+  std::map<uint64_t, SymbolDesc> Symbols;
----------------
jh7370 wrote:

Are you sure you want a `std::map` and not a sorted vector. https://llvm.org/docs/ProgrammersManual.html#map-like-containers-std-map-densemap-etc gives a lot of thoughts on this and provides various other alternatives too that might be more efficient.

https://github.com/llvm/llvm-project/pull/69552


More information about the llvm-commits mailing list