[PATCH] D98837: [lld][MachO] Refactor handling of subsections

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 28 18:27:39 PDT 2021


alexshap added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:424-426
+      subsections[sym.n_sect - 1].push_back(
+          {sym.n_value - sectionHeaders[sym.n_sect - 1].addr,
+           subsections[sym.n_sect - 1].front().second});
----------------
oontvoo wrote:
> nit:
https://abseil.io/tips/112,  i don't have a strong opinion regarding this, both would work just fine


================
Comment at: lld/MachO/InputFiles.cpp:482-485
+  if (!subsectionsViaSymbols)
+    for (SubsectionMap &subsectionMap : subsections)
+      if (!subsectionMap.empty())
+        subsectionMap = {subsectionMap.front()};
----------------
int3 wrote:
> instead of truncating the vector here, can we just skip the loop on line 421 if `subsectionsViaSymbols` is false? I think the loop on line 429 could be skipped too actually
<discussed offline>, I'll add a comment 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98837



More information about the llvm-commits mailing list