[lld] r325706 - [WebAssembly] Use make<> rather then make_unique<>. NFC.

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 10:37:44 PST 2018


Author: sbc
Date: Wed Feb 21 10:37:44 2018
New Revision: 325706

URL: http://llvm.org/viewvc/llvm-project?rev=325706&view=rev
Log:
[WebAssembly] Use make<> rather then make_unique<>. NFC.

lld uses an arena allocator to one of allocations
like these can just use make<>.

Differential Revision: https://reviews.llvm.org/D43587

Modified:
    lld/trunk/wasm/Writer.cpp

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=325706&r1=325705&r2=325706&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Wed Feb 21 10:37:44 2018
@@ -131,7 +131,6 @@ private:
   std::vector<OutputSection *> OutputSections;
 
   std::unique_ptr<FileOutputBuffer> Buffer;
-  std::unique_ptr<SyntheticFunction> CtorFunction;
   std::string CtorFunctionBody;
 
   std::vector<OutputSegment *> Segments;
@@ -852,10 +851,10 @@ void Writer::createCtorFunction() {
   ArrayRef<uint8_t> BodyArray(
       reinterpret_cast<const uint8_t *>(CtorFunctionBody.data()),
       CtorFunctionBody.size());
-  CtorFunction = llvm::make_unique<SyntheticFunction>(
-      Signature, BodyArray, WasmSym::CallCtors->getName());
-  CtorFunction->setOutputIndex(FunctionIndex);
-  InputFunctions.emplace_back(CtorFunction.get());
+  SyntheticFunction *F = make<SyntheticFunction>(Signature, BodyArray,
+                                                 WasmSym::CallCtors->getName());
+  F->setOutputIndex(FunctionIndex);
+  InputFunctions.emplace_back(F);
 }
 
 // Populate InitFunctions vector with init functions from all input objects.




More information about the llvm-commits mailing list