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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 01:04:16 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:

I don't think there's an issue expanding `SymbolDesc` with more fields as necessary, though for the sake of memory usage, I'd try to keep those elements as small as possible. That would be the preferred approach for adding more conditions to sort on.

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


More information about the llvm-commits mailing list