[llvm] [BPF] Use heterogeneous lookup with std::map (NFC) (PR #143395)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 23:51:27 PDT 2025


================
@@ -300,7 +300,8 @@ class BTFDebug : public DebugHandlerBase {
   std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
   std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
   StringMap<std::vector<std::string>> FileContent;
-  std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries;
+  std::map<std::string, std::unique_ptr<BTFKindDataSec>, std::less<>>
----------------
kazutakahirata wrote:

It is relevant.  `std::less<>` makes it possible to compare `StringRef` and `std::string`.

Heterogeneous lookup is explained in:

https://www.cppstories.com/2019/05/heterogeneous-lookup-cpp14/

Look for `std::less<>`.


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


More information about the llvm-commits mailing list