[PATCH] D63596: [yaml2obj/obj2yaml] - Allow having the symbols and sections with duplicated names.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 21:45:45 PDT 2019


MaskRay added inline comments.


================
Comment at: tools/obj2yaml/elf2yaml.cpp:35
+  // we add a special suffix to make them unique.
   unsigned Suffix = 0;
+
----------------
`Suffix` is shared: we may get `.a` `.a [1]` `.b` `.b [2]` `.b [3]`

Can `DenseSet<StringRef> UsedSectionNames;` be changed to `DenseMap<StringRef, int>` to have a per-section suffix number?


================
Comment at: tools/obj2yaml/elf2yaml.cpp:98
+  if (!UsedSectionNames.insert(Name).second)
+    Ret = (Name + " [" + to_string(++Suffix) + "]").str();
+  else
----------------
`Twine(++Suffix)` eliminates the cost to construct a string.


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

https://reviews.llvm.org/D63596





More information about the llvm-commits mailing list