[llvm] r204512 - InstrProf: Use move semantics with unique_ptr
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Mar 21 13:42:34 PDT 2014
Author: dexonsmith
Date: Fri Mar 21 15:42:34 2014
New Revision: 204512
URL: http://llvm.org/viewvc/llvm-project?rev=204512&view=rev
Log:
InstrProf: Use move semantics with unique_ptr
<rdar://problem/15950346>
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
llvm/trunk/lib/ProfileData/InstrProfReader.cpp
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=204512&r1=204511&r2=204512&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfReader.h Fri Mar 21 15:42:34 2014
@@ -113,8 +113,8 @@ private:
TextInstrProfReader &operator=(const TextInstrProfReader &)
LLVM_DELETED_FUNCTION;
public:
- TextInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer_)
- : DataBuffer(DataBuffer_.release()), Line(*DataBuffer, '#') {}
+ TextInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer_)
+ : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, '#') {}
/// Read the header.
error_code readHeader() override { return success(); }
@@ -161,7 +161,7 @@ private:
RawInstrProfReader &operator=(const TextInstrProfReader &)
LLVM_DELETED_FUNCTION;
public:
- RawInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer);
+ RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer);
static bool hasFormat(const MemoryBuffer &DataBuffer);
error_code readHeader() override;
Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=204512&r1=204511&r2=204512&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Fri Mar 21 15:42:34 2014
@@ -31,9 +31,9 @@ error_code InstrProfReader::create(std::
// Create the reader.
if (RawInstrProfReader::hasFormat(*Buffer))
- Result.reset(new RawInstrProfReader(Buffer));
+ Result.reset(new RawInstrProfReader(std::move(Buffer)));
else
- Result.reset(new TextInstrProfReader(Buffer));
+ Result.reset(new TextInstrProfReader(std::move(Buffer)));
// Read the header and return the result.
return Result->readHeader();
@@ -85,8 +85,8 @@ error_code TextInstrProfReader::readNext
return success();
}
-RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer)
- : DataBuffer(DataBuffer.release()) { }
+RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer)
+ : DataBuffer(std::move(DataBuffer)) { }
static uint64_t getRawMagic() {
return
More information about the llvm-commits
mailing list