[PATCH] D43855: [WebAssembly] Use toArrayRef. NFC.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 09:45:55 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD326340: [WebAssembly] Use toArrayRef. NFC. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43855?vs=136220&id=136319#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43855

Files:
  wasm/Writer.cpp


Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -17,6 +17,7 @@
 #include "WriterUtils.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
+#include "lld/Common/Strings.h"
 #include "lld/Common/Threads.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/BinaryFormat/Wasm.h"
@@ -876,7 +877,6 @@
 
   // First write the body bytes to a string.
   std::string FunctionBody;
-  const WasmSignature *Signature = WasmSym::CallCtors->getFunctionType();
   {
     raw_string_ostream OS(FunctionBody);
     writeUleb128(OS, 0, "num locals");
@@ -892,11 +892,11 @@
   writeUleb128(OS, FunctionBody.size(), "function size");
   OS.flush();
   CtorFunctionBody += FunctionBody;
-  ArrayRef<uint8_t> BodyArray(
-      reinterpret_cast<const uint8_t *>(CtorFunctionBody.data()),
-      CtorFunctionBody.size());
-  SyntheticFunction *F = make<SyntheticFunction>(*Signature, BodyArray,
-                                                 WasmSym::CallCtors->getName());
+
+  const WasmSignature *Sig = WasmSym::CallCtors->getFunctionType();
+  SyntheticFunction *F = make<SyntheticFunction>(
+      *Sig, toArrayRef(CtorFunctionBody), WasmSym::CallCtors->getName());
+
   F->setOutputIndex(FunctionIndex);
   F->Live = true;
   WasmSym::CallCtors->Function = F;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43855.136319.patch
Type: text/x-patch
Size: 1351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/f444a16e/attachment.bin>


More information about the llvm-commits mailing list