[PATCH] D43493: [WebAssembly] Remove InputChunk from Symbol baseclass. NFC.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 20:36:03 PST 2018


ruiu added inline comments.


================
Comment at: wasm/Symbols.cpp:33
+  if (auto *F = dyn_cast<DefinedFunction>(this))
+    if (F->Function) return F->Function->hasOutputIndex();
   return OutputIndex != INVALID_INDEX;
----------------
Newline before return.


================
Comment at: wasm/Symbols.cpp:39
+  if (auto *F = dyn_cast<DefinedFunction>(this))
+    if (F->Function) return F->Function->getOutputIndex();
   assert(OutputIndex != INVALID_INDEX);
----------------
Ditto


================
Comment at: wasm/Symbols.h:106
   FunctionSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F,
-                 InputFunction *Function);
-
-  FunctionSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F,
-                 const WasmSignature* Type)
-      : Symbol(Name, K, Flags, F, nullptr), FunctionType(Type) {}
+                 const WasmSignature *Type = nullptr)
+      : Symbol(Name, K, Flags, F), FunctionType(Type) {}
----------------
I think Type is always given.


================
Comment at: wasm/Writer.cpp:665
         continue;
-      if (!Sym->getChunk()->Live)
+      if (!Sym->isLive())
         continue;
----------------
I would recommend removing Symbol::isLive and use getChunk() and isLive() directly instead. It is because the notion of dead/alive is about chunks (or sections), and symbols are not directly considered as dead/alive. You could think that symbols are dead if they point to dead sections, and that makes some sense, but I think that not adding isLive() to Symbol makes things easier to understand.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43493





More information about the llvm-commits mailing list