From 29abfe4a8fe08bdd2f1c3b9e139a4547eb9261cc Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 28 Feb 2018 17:43:15 +0000 Subject: [PATCH] [WebAssembly] Use toArrayRef. NFC. Differential Revision: https://reviews.llvm.org/D43855 llvm-svn: 326340 --- lld/wasm/Writer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 539bf8b..29de6e2 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/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 @@ void Writer::createCtorFunction() { // 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 @@ void Writer::createCtorFunction() { writeUleb128(OS, FunctionBody.size(), "function size"); OS.flush(); CtorFunctionBody += FunctionBody; - ArrayRef BodyArray( - reinterpret_cast(CtorFunctionBody.data()), - CtorFunctionBody.size()); - SyntheticFunction *F = make(*Signature, BodyArray, - WasmSym::CallCtors->getName()); + + const WasmSignature *Sig = WasmSym::CallCtors->getFunctionType(); + SyntheticFunction *F = make( + *Sig, toArrayRef(CtorFunctionBody), WasmSym::CallCtors->getName()); + F->setOutputIndex(FunctionIndex); F->Live = true; WasmSym::CallCtors->Function = F; -- 2.7.4