[PATCH] D43406: Merge two small functions and add comments.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 14:46:33 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD325538: Merge two small functions and add comments. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43406?vs=134740&id=134976#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43406

Files:
  wasm/InputChunks.cpp


Index: wasm/InputChunks.cpp
===================================================================
--- wasm/InputChunks.cpp
+++ wasm/InputChunks.cpp
@@ -78,19 +78,19 @@
   }
 }
 
-static void applyRelocations(uint8_t *Buf, ArrayRef<OutputRelocation> Relocs) {
-  if (!Relocs.size())
+// Copy this input chunk to an mmap'ed output file.
+void InputChunk::writeTo(uint8_t *Buf) const {
+  // Copy contents
+  memcpy(Buf + getOutputOffset(), data().data(), data().size());
+
+  // Apply relocations
+  if (OutRelocations.empty())
     return;
-  DEBUG(dbgs() << "applyRelocations: count=" << Relocs.size() << "\n");
-  for (const OutputRelocation &Reloc : Relocs)
+  DEBUG(dbgs() << "applyRelocations: count=" << OutRelocations.size() << "\n");
+  for (const OutputRelocation &Reloc : OutRelocations)
     applyRelocation(Buf, Reloc);
 }
 
-void InputChunk::writeTo(uint8_t *SectionStart) const {
-  memcpy(SectionStart + getOutputOffset(), data().data(), data().size());
-  applyRelocations(SectionStart, OutRelocations);
-}
-
 // Populate OutRelocations based on the input relocations and offset within the
 // output section.  Calculates the updated index and offset for each relocation
 // as well as the value to write out in the final binary.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43406.134976.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180219/7b7e0e74/attachment-0001.bin>


More information about the llvm-commits mailing list