[PATCH] D43725: [WebAssembly] Remove another trivial accessor.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 12:40:29 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329336: [WebAssembly] Remove another trivial accessor. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43725?vs=135782&id=141200#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43725

Files:
  lld/trunk/wasm/OutputSections.cpp
  lld/trunk/wasm/OutputSegment.h


Index: lld/trunk/wasm/OutputSegment.h
===================================================================
--- lld/trunk/wasm/OutputSegment.h
+++ lld/trunk/wasm/OutputSegment.h
@@ -32,12 +32,9 @@
     Size += InSeg->getSize();
   }
 
-  uint32_t getSectionOffset() const { return SectionOffset; }
-
-  void setSectionOffset(uint32_t Offset) { SectionOffset = Offset; }
-
   StringRef Name;
   const uint32_t Index;
+  uint32_t SectionOffset = 0;
   uint32_t Alignment = 0;
   uint32_t StartVA = 0;
   std::vector<InputSegment *> InputSegments;
@@ -47,9 +44,6 @@
 
   // Segment header
   std::string Header;
-
-private:
-  uint32_t SectionOffset = 0;
 };
 
 } // namespace wasm
Index: lld/trunk/wasm/OutputSections.cpp
===================================================================
--- lld/trunk/wasm/OutputSections.cpp
+++ lld/trunk/wasm/OutputSections.cpp
@@ -140,12 +140,13 @@
     writeUleb128(OS, WASM_OPCODE_END, "opcode:end");
     writeUleb128(OS, Segment->Size, "segment size");
     OS.flush();
-    Segment->setSectionOffset(BodySize);
+
+    Segment->SectionOffset = BodySize;
     BodySize += Segment->Header.size() + Segment->Size;
     log("Data segment: size=" + Twine(Segment->Size));
+
     for (InputSegment *InputSeg : Segment->InputSegments)
-      InputSeg->OutputOffset = Segment->getSectionOffset() +
-                               Segment->Header.size() +
+      InputSeg->OutputOffset = Segment->SectionOffset + Segment->Header.size() +
                                InputSeg->OutputSegmentOffset;
   }
 
@@ -166,7 +167,7 @@
 
   parallelForEach(Segments, [&](const OutputSegment *Segment) {
     // Write data segment header
-    uint8_t *SegStart = Buf + Segment->getSectionOffset();
+    uint8_t *SegStart = Buf + Segment->SectionOffset;
     memcpy(SegStart, Segment->Header.data(), Segment->Header.size());
 
     // Write segment data payload


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43725.141200.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180405/9ab3a4ef/attachment.bin>


More information about the llvm-commits mailing list