<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 16, 2015 at 3:27 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Jun 16 17:27:55 2015<br>
New Revision: 239858<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239858-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=agIxnqOzeooIsD-j6_z09DBLcRrTc4cdLWCn1iSJgng&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239858&view=rev</a><br>
Log:<br>
Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/Bitcode/ReaderWriter.h<br>
llvm/trunk/lib/Bitcode/Reader/BitReader.cpp<br>
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
llvm/trunk/lib/IRReader/IRReader.cpp<br>
llvm/trunk/lib/LTO/LTOModule.cpp<br>
llvm/trunk/lib/Object/IRObjectFile.cpp<br>
llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp<br>
llvm/trunk/unittests/Bitcode/BitReaderTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_Bitcode_ReaderWriter.h-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=dBCnudXFW-_cGYY7Ui1SrkkNEK8qgcgFNUJxJsfNlh4&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original)<br>
+++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Tue Jun 16 17:27:55 2015<br>
@@ -32,7 +32,7 @@ namespace llvm {<br>
/// deserialization of function bodies. If ShouldLazyLoadMetadata is true,<br>
/// lazily load metadata as well. If successful, this moves Buffer. On<br>
/// error, this *does not* move Buffer.<br>
- ErrorOr<Module *><br>
+ ErrorOr<std::unique_ptr<Module>><br>
getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,<br>
LLVMContext &Context,<br>
DiagnosticHandlerFunction DiagnosticHandler = nullptr,<br>
@@ -52,7 +52,7 @@ namespace llvm {<br>
DiagnosticHandlerFunction DiagnosticHandler = nullptr);<br>
<br>
/// Read the specified bitcode file, returning the module.<br>
- ErrorOr<Module *><br>
+ ErrorOr<std::unique_ptr<Module>><br>
parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,<br>
DiagnosticHandlerFunction DiagnosticHandler = nullptr);<br>
<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Bitcode_Reader_BitReader.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=a7IqY1KX2ngdAPsnf1miu1xpP2RsuPBAJneBhynmjZc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Tue Jun 16 17:27:55 2015<br>
@@ -39,7 +39,7 @@ LLVMBool LLVMParseBitcodeInContext(LLVMC<br>
raw_string_ostream Stream(Message);<br>
DiagnosticPrinterRawOStream DP(Stream);<br>
<br>
- ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr = parseBitcodeFile(<br>
Buf, Ctx, [&](const DiagnosticInfo &DI) { DI.print(DP); });<br>
if (ModuleOrErr.getError()) {<br>
if (OutMessage) {<br>
@@ -50,7 +50,7 @@ LLVMBool LLVMParseBitcodeInContext(LLVMC<br>
return 1;<br>
}<br>
<br>
- *OutModule = wrap(ModuleOrErr.get());<br>
+ *OutModule = wrap(ModuleOrErr.get().release());<br>
return 0;<br>
}<br>
<br>
@@ -64,7 +64,7 @@ LLVMBool LLVMGetBitcodeModuleInContext(L<br>
std::string Message;<br>
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));<br>
<br>
- ErrorOr<Module *> ModuleOrErr =<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr =<br>
getLazyBitcodeModule(std::move(Owner), *unwrap(ContextRef));<br>
Owner.release();<br>
<br>
@@ -75,7 +75,7 @@ LLVMBool LLVMGetBitcodeModuleInContext(L<br>
return 1;<br>
}<br>
<br>
- *OutM = wrap(ModuleOrErr.get());<br>
+ *OutM = wrap(ModuleOrErr.get().release());<br>
<br>
return 0;<br>
<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Bitcode_Reader_BitcodeReader.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=M_NU_y6iFynf2zJUfplH-a26MSHHAUYgzzgy9m832ng&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jun 16 17:27:55 2015<br>
@@ -4600,24 +4600,24 @@ const std::error_category &llvm::Bitcode<br>
///<br>
/// \param[in] WillMaterializeAll Set to \c true if the caller promises to<br>
/// materialize everything -- in particular, if this isn't truly lazy.<br>
-static ErrorOr<Module *><br>
+static ErrorOr<std::unique_ptr<Module>><br>
getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &&Buffer,<br>
LLVMContext &Context, bool WillMaterializeAll,<br>
DiagnosticHandlerFunction DiagnosticHandler,<br>
bool ShouldLazyLoadMetadata = false) {<br>
- Module *M = new Module(Buffer->getBufferIdentifier(), Context);<br>
+ std::unique_ptr<Module> M =<br>
+ make_unique<Module>(Buffer->getBufferIdentifier(), Context);<br>
BitcodeReader *R =<br>
new BitcodeReader(Buffer.get(), Context, DiagnosticHandler);<br>
M->setMaterializer(R);<br>
<br>
auto cleanupOnError = [&](std::error_code EC) {<br>
R->releaseBuffer(); // Never take ownership on error.<br>
- delete M; // Also deletes R.<br>
return EC;<br>
};<br>
<br>
// Delay parsing Metadata if ShouldLazyLoadMetadata is true.<br>
- if (std::error_code EC = R->parseBitcodeInto(M, ShouldLazyLoadMetadata))<br>
+ if (std::error_code EC = R->parseBitcodeInto(M.get(), ShouldLazyLoadMetadata))<br>
return cleanupOnError(EC);<br>
<br>
if (!WillMaterializeAll)<br>
@@ -4626,14 +4626,12 @@ getLazyBitcodeModuleImpl(std::unique_ptr<br>
return cleanupOnError(EC);<br>
<br>
Buffer.release(); // The BitcodeReader owns it now.<br>
- return M;<br>
+ return std::move(M);<br>
}<br>
<br>
-ErrorOr<Module *><br>
-llvm::getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,<br>
- LLVMContext &Context,<br>
- DiagnosticHandlerFunction DiagnosticHandler,<br>
- bool ShouldLazyLoadMetadata) {<br>
+ErrorOr<std::unique_ptr<Module>> llvm::getLazyBitcodeModule(<br>
+ std::unique_ptr<MemoryBuffer> &&Buffer, LLVMContext &Context,<br>
+ DiagnosticHandlerFunction DiagnosticHandler, bool ShouldLazyLoadMetadata) {<br>
return getLazyBitcodeModuleImpl(std::move(Buffer), Context, false,<br>
DiagnosticHandler, ShouldLazyLoadMetadata);<br>
}<br>
@@ -4650,25 +4648,23 @@ llvm::getStreamedBitcodeModule(StringRef<br>
return std::move(M);<br>
}<br>
<br>
-ErrorOr<Module *><br>
+ErrorOr<std::unique_ptr<Module>><br>
llvm::parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,<br>
DiagnosticHandlerFunction DiagnosticHandler) {<br>
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);<br>
- ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModuleImpl(<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr = getLazyBitcodeModuleImpl(<br>
std::move(Buf), Context, true, DiagnosticHandler);<br>
if (!ModuleOrErr)<br>
return ModuleOrErr;<br>
- Module *M = ModuleOrErr.get();<br>
+ std::unique_ptr<Module> &M = ModuleOrErr.get();<br>
// Read in the entire module, and destroy the BitcodeReader.<br>
- if (std::error_code EC = M->materializeAllPermanently()) {<br>
- delete M;<br>
+ if (std::error_code EC = M->materializeAllPermanently())<br>
return EC;<br>
- }<br>
<br>
// TODO: Restore the use-lists to the in-memory state when the bitcode was<br>
// written. We must defer until the Module has been fully materialized.<br>
<br>
- return M;<br>
+ return std::move(M);<br>
}<br>
<br>
std::string<br>
<br>
Modified: llvm/trunk/lib/IRReader/IRReader.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_IRReader_IRReader.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=ftINgaa7ignhFz2xrZp8EuTtXhuyTIqbd8nVbGiq01o&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IRReader/IRReader.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IRReader/IRReader.cpp (original)<br>
+++ llvm/trunk/lib/IRReader/IRReader.cpp Tue Jun 16 17:27:55 2015<br>
@@ -34,14 +34,14 @@ getLazyIRModule(std::unique_ptr<MemoryBu<br>
LLVMContext &Context) {<br>
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),<br>
(const unsigned char *)Buffer->getBufferEnd())) {<br>
- ErrorOr<Module *> ModuleOrErr =<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr =<br>
getLazyBitcodeModule(std::move(Buffer), Context);<br>
if (std::error_code EC = ModuleOrErr.getError()) {<br>
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,<br>
EC.message());<br>
return nullptr;<br>
}<br>
- return std::unique_ptr<Module>(ModuleOrErr.get());<br>
+ return std::move(ModuleOrErr.get());<br></blockquote><div><br>You could probably just "return ModuleOrErr;" here?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
return parseAssembly(Buffer->getMemBufferRef(), Err, Context);<br>
@@ -67,13 +67,14 @@ std::unique_ptr<Module> llvm::parseIR(Me<br>
TimePassesIsEnabled);<br>
if (isBitcode((const unsigned char *)Buffer.getBufferStart(),<br>
(const unsigned char *)Buffer.getBufferEnd())) {<br>
- ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(Buffer, Context);<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr =<br>
+ parseBitcodeFile(Buffer, Context);<br>
if (std::error_code EC = ModuleOrErr.getError()) {<br>
Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,<br>
EC.message());<br>
return nullptr;<br>
}<br>
- return std::unique_ptr<Module>(ModuleOrErr.get());<br>
+ return std::move(ModuleOrErr.get());<br></blockquote><div><br>And here.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
return parseAssembly(Buffer, Err, Context);<br>
<br>
Modified: llvm/trunk/lib/LTO/LTOModule.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_LTO_LTOModule.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=gRmmZA2GISWwtXFubfn471WgvzsVkyKGY_eew3UhkgE&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/LTO/LTOModule.cpp (original)<br>
+++ llvm/trunk/lib/LTO/LTOModule.cpp Tue Jun 16 17:27:55 2015<br>
@@ -147,9 +147,10 @@ LTOModule *LTOModule::createInContext(co<br>
return makeLTOModule(Buffer, options, errMsg, Context);<br>
}<br>
<br>
-static Module *parseBitcodeFileImpl(MemoryBufferRef Buffer,<br>
- LLVMContext &Context, bool ShouldBeLazy,<br>
- std::string &ErrMsg) {<br>
+static std::unique_ptr<Module> parseBitcodeFileImpl(MemoryBufferRef Buffer,<br>
+ LLVMContext &Context,<br>
+ bool ShouldBeLazy,<br>
+ std::string &ErrMsg) {<br>
<br>
// Find the buffer.<br>
ErrorOr<MemoryBufferRef> MBOrErr =<br>
@@ -168,22 +169,22 @@ static Module *parseBitcodeFileImpl(Memo<br>
<br>
if (!ShouldBeLazy) {<br>
// Parse the full file.<br>
- ErrorOr<Module *> M =<br>
+ ErrorOr<std::unique_ptr<Module>> M =<br>
parseBitcodeFile(*MBOrErr, Context, DiagnosticHandler);<br>
if (!M)<br>
return nullptr;<br>
- return *M;<br>
+ return std::move(*M);<br>
}<br>
<br>
// Parse lazily.<br>
std::unique_ptr<MemoryBuffer> LightweightBuf =<br>
MemoryBuffer::getMemBuffer(*MBOrErr, false);<br>
- ErrorOr<Module *> M = getLazyBitcodeModule(std::move(LightweightBuf), Context,<br>
- DiagnosticHandler,<br>
- true/*ShouldLazyLoadMetadata*/);<br>
+ ErrorOr<std::unique_ptr<Module>> M =<br>
+ getLazyBitcodeModule(std::move(LightweightBuf), Context,<br>
+ DiagnosticHandler, true /*ShouldLazyLoadMetadata*/);<br>
if (!M)<br>
return nullptr;<br>
- return *M;<br>
+ return std::move(*M);<br>
}<br>
<br>
LTOModule *LTOModule::makeLTOModule(MemoryBufferRef Buffer,<br>
@@ -197,9 +198,9 @@ LTOModule *LTOModule::makeLTOModule(Memo<br>
<br>
// If we own a context, we know this is being used only for symbol<br>
// extraction, not linking. Be lazy in that case.<br>
- std::unique_ptr<Module> M(parseBitcodeFileImpl(<br>
+ std::unique_ptr<Module> M = parseBitcodeFileImpl(<br>
Buffer, *Context,<br>
- /* ShouldBeLazy */ static_cast<bool>(OwnedContext), errMsg));<br>
+ /* ShouldBeLazy */ static_cast<bool>(OwnedContext), errMsg);<br>
if (!M)<br>
return nullptr;<br>
<br>
<br>
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Object_IRObjectFile.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=AJH6_nJmYriXE_4H6m1hJVTejI5cDMOm9III5Mp4pnY&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Tue Jun 16 17:27:55 2015<br>
@@ -304,12 +304,12 @@ llvm::object::IRObjectFile::create(Memor<br>
std::unique_ptr<MemoryBuffer> Buff(<br>
MemoryBuffer::getMemBuffer(BCOrErr.get(), false));<br>
<br>
- ErrorOr<Module *> MOrErr =<br>
+ ErrorOr<std::unique_ptr<Module>> MOrErr =<br>
getLazyBitcodeModule(std::move(Buff), Context, nullptr,<br>
/*ShouldLazyLoadMetadata*/ true);<br>
if (std::error_code EC = MOrErr.getError())<br>
return EC;<br>
<br>
- std::unique_ptr<Module> M(MOrErr.get());<br>
+ std::unique_ptr<Module> &M = MOrErr.get();<br>
return llvm::make_unique<IRObjectFile>(Object, std::move(M));<br>
}<br>
<br>
Modified: llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_verify-2Duselistorder_verify-2Duselistorder.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=mTPqEIFbalGVtCG-OpJIDQMCqDpupQ3FEea6WNDYXS0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp (original)<br>
+++ llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp Tue Jun 16 17:27:55 2015<br>
@@ -159,14 +159,14 @@ std::unique_ptr<Module> TempFile::readBi<br>
}<br>
<br>
MemoryBuffer *Buffer = BufferOr.get().get();<br>
- ErrorOr<Module *> ModuleOr =<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOr =<br>
parseBitcodeFile(Buffer->getMemBufferRef(), Context);<br>
if (!ModuleOr) {<br>
errs() << "verify-uselistorder: error: " << ModuleOr.getError().message()<br>
<< "\n";<br>
return nullptr;<br>
}<br>
- return std::unique_ptr<Module>(ModuleOr.get());<br>
+ return std::move(ModuleOr.get());<br>
}<br>
<br>
std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const {<br>
<br>
Modified: llvm/trunk/unittests/Bitcode/BitReaderTest.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_Bitcode_BitReaderTest.cpp-3Frev-3D239858-26r1-3D239857-26r2-3D239858-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=mt95iYNYAWj00I8nesODwVJTUNfAhwZm4jShBgiS3tY&s=AcWMkuXwxyIyJrBz3Wc2yn9sWIydjARsJZMaRR3H8QI&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Bitcode/BitReaderTest.cpp?rev=239858&r1=239857&r2=239858&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/Bitcode/BitReaderTest.cpp (original)<br>
+++ llvm/trunk/unittests/Bitcode/BitReaderTest.cpp Tue Jun 16 17:27:55 2015<br>
@@ -53,9 +53,9 @@ static std::unique_ptr<Module> getLazyMo<br>
writeModuleToBuffer(parseAssembly(Assembly), Mem);<br>
std::unique_ptr<MemoryBuffer> Buffer =<br>
MemoryBuffer::getMemBuffer(Mem.str(), "test", false);<br>
- ErrorOr<Module *> ModuleOrErr =<br>
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr =<br>
getLazyBitcodeModule(std::move(Buffer), Context);<br>
- return std::unique_ptr<Module>(ModuleOrErr.get());<br>
+ return std::move(ModuleOrErr.get());<br>
}<br>
<br>
TEST(BitReaderTest, DematerializeFunctionPreservesLinkageType) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>