[PATCH] D114736: [lld][MachO][NFC] Pull out code into helper function.

Roger Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 23 10:35:31 PST 2021


Roger created this revision.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
Roger updated this revision to Diff 394955.
Roger added a comment.
Roger updated this revision to Diff 395004.
Roger updated this revision to Diff 396049.
Roger edited the summary of this revision.
Roger published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

small fix.


Roger added a comment.

Compilation fix.


Roger added a comment.

test passes


This is currently in a separate commit for the ease of review.
In the final commits, this will likely be merged into one diff that
includes the functional changes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114736

Files:
  lld/MachO/MapFile.cpp


Index: lld/MachO/MapFile.cpp
===================================================================
--- lld/MachO/MapFile.cpp
+++ lld/MachO/MapFile.cpp
@@ -125,12 +125,15 @@
     }
 
   // Dump table of symbols
+  auto writeSymbols = [&](const std::vector<Defined *> &syms) {
+    os << "# Address\t    File  Name\n";
+    for (Symbol *sym : syms) {
+      os << format("0x%08llX\t[%3u] %s\n", sym->getVA(),
+                   readerToFileOrdinal[sym->getFile()], symStr[sym].c_str());
+    }
+  };
+
   os << "# Symbols:\n";
-  os << "# Address\t    File  Name\n";
-  for (Symbol *sym : syms) {
-    os << format("0x%08llX\t[%3u] %s\n", sym->getVA(),
-                 readerToFileOrdinal[sym->getFile()], symStr[sym].c_str());
-  }
-
+  writeSymbols(syms);
   // TODO: when we implement -dead_strip, we should dump dead stripped symbols
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114736.396049.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211223/f5dd73fb/attachment.bin>


More information about the llvm-commits mailing list