[PATCH] D42233: [WebAssembly] Better support for WASM Object format
    Sam Clegg via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jan 29 09:40:26 PST 2018
    
    
  
sbc100 added inline comments.
================
Comment at: lib/Object/WasmObjectFile.cpp:995
+void WasmObjectFile::moveSectionNext(DataRefImpl &Sec) const { 
+  if (isSectionData(Sec) && (Sec.d.b < (DataSegments.size()))) {
+    Sec.d.b++;
----------------
Remove extra brackets around `DataSegments.size()`
================
Comment at: lib/Object/WasmObjectFile.cpp:1025
+    if (isSectionWasmDataSegment(Sec))
+      Res = getSectionWasmDataSegment(Sec).Name;
+    
----------------
Use if/else here
================
Comment at: lib/Object/WasmObjectFile.cpp:1046
 uint64_t WasmObjectFile::getSectionSize(DataRefImpl Sec) const {
-  const WasmSection &S = Sections[Sec.d.a];
-  return S.Content.size();
+  return getSectionContentArrayRef(Sec).size();
 }
----------------
Just use getSectionContents() here?
================
Comment at: lib/Object/WasmObjectFile.cpp:1052
+
+  const ArrayRef<uint8_t> &Content = getSectionContentArrayRef(Sec); 
+
----------------
No need for getSectionContentArrayRef method I think, just put that logic right here.
================
Comment at: lib/Object/WasmObjectFile.cpp:1129
+
+
   return relocation_iterator(RelocationRef(RelocRef, this));
----------------
remove extra newline
================
Comment at: tools/llvm-readobj/WasmDumper.cpp:148
     const WasmSection &WasmSec = Obj->getWasmSection(Section);
+    if (Obj->isSectionWasmDataSegment(Section))
+      continue;
----------------
Move this up before the declaration of WasmSec
https://reviews.llvm.org/D42233
    
    
More information about the llvm-commits
mailing list