[PATCH] D154341: use StringMap in llvm-dwp when merging debug_str.dwo section

zhuna via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 4 06:27:19 PDT 2023


zhuna8616 updated this revision to Diff 537081.
zhuna8616 added a comment.

correct StringRef in make_pair


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154341/new/

https://reviews.llvm.org/D154341

Files:
  llvm/include/llvm/DWP/DWPStringPool.h


Index: llvm/include/llvm/DWP/DWPStringPool.h
===================================================================
--- llvm/include/llvm/DWP/DWPStringPool.h
+++ llvm/include/llvm/DWP/DWPStringPool.h
@@ -32,7 +32,7 @@
 
   MCStreamer &Out;
   MCSection *Sec;
-  DenseMap<const char *, uint32_t, CStrDenseMapInfo> Pool;
+  StringMap<uint32_t> Pool;
   uint32_t Offset = 0;
 
 public:
@@ -41,7 +41,7 @@
   uint32_t getOffset(const char *Str, unsigned Length) {
     assert(strlen(Str) + 1 == Length && "Ensure length hint is correct");
 
-    auto Pair = Pool.insert(std::make_pair(Str, Offset));
+    auto Pair = Pool.insert(std::make_pair(StringRef(Str, Length), Offset));
     if (Pair.second) {
       Out.switchSection(Sec);
       Out.emitBytes(StringRef(Str, Length));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154341.537081.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230704/a7f66148/attachment.bin>


More information about the llvm-commits mailing list