[PATCH] D43933: [WebAssembly] Pass ownership of body to SyntheticFunction and assert type. NFC

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 08:50:37 PST 2018

ruiu added inline comments.

Comment at: wasm/Writer.cpp:893
 void Writer::calculateInitFunctions() {
+  WasmSignature VoidSignature = {{}, WASM_TYPE_NORESULT};
Remove this variable and inline it. Otherwise you'll get a "unused variable" warning for non-NDEBUG build.

Comment at: wasm/Writer.cpp:899
+      FunctionSymbol *Sym = File->getFunctionSymbol(F.Symbol);
+      assert(*Sym->getFunctionType() == VoidSignature);
+      InitFunctions.emplace_back(WasmInitEntry{Sym, F.Priority});
sbc100 wrote:
> How about just `assert(*Sym->getFunctionType() == WasmSignature{{}, WASM_TYPE_NORESULT});`
> Then the release build won't need the extra variable.
> This seems like its really a separate change.
If you can trigger this by feeding an object file with a bad init function, you should use error() instead of assert(). assert() is for checking internal consistency only.

  rLLD LLVM Linker


More information about the llvm-commits mailing list