[PATCH] D54687: [WebAssembly] Make starting indices calcaulation simpler (NFC)
    Heejin Ahn via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Nov 19 15:20:15 PST 2018
    
    
  
aheejin updated this revision to Diff 174693.
aheejin added a comment.
- Add assertions
Repository:
  rLLD LLVM Linker
https://reviews.llvm.org/D54687
Files:
  wasm/Writer.cpp
Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -891,7 +891,8 @@
 }
 
 void Writer::assignIndexes() {
-  uint32_t FunctionIndex = NumImportedFunctions + InputFunctions.size();
+  assert(InputFunctions.empty());
+  uint32_t FunctionIndex = NumImportedFunctions;
   auto AddDefinedFunction = [&](InputFunction *Func) {
     if (!Func->Live)
       return;
@@ -940,7 +941,8 @@
       HandleRelocs(P);
   }
 
-  uint32_t GlobalIndex = NumImportedGlobals + InputGlobals.size();
+  assert(InputGlobals.empty());
+  uint32_t GlobalIndex = NumImportedGlobals;
   auto AddDefinedGlobal = [&](InputGlobal *Global) {
     if (Global->Live) {
       LLVM_DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54687.174693.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/578ce58e/attachment.bin>
    
    
More information about the llvm-commits
mailing list