From bc2740a5981161bec9d81be36cb135428cb26b6d Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 21 Mar 2014 20:42:34 +0000 Subject: InstrProf: Use move semantics with unique_ptr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204512 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ProfileData/InstrProfReader.h | 6 +++--- lib/ProfileData/InstrProfReader.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/llvm/ProfileData/InstrProfReader.h b/include/llvm/ProfileData/InstrProfReader.h index 3cfbf805a5..d236fecdb6 100644 --- a/include/llvm/ProfileData/InstrProfReader.h +++ b/include/llvm/ProfileData/InstrProfReader.h @@ -113,8 +113,8 @@ private: TextInstrProfReader &operator=(const TextInstrProfReader &) LLVM_DELETED_FUNCTION; public: - TextInstrProfReader(std::unique_ptr &DataBuffer_) - : DataBuffer(DataBuffer_.release()), Line(*DataBuffer, '#') {} + TextInstrProfReader(std::unique_ptr 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 &DataBuffer); + RawInstrProfReader(std::unique_ptr DataBuffer); static bool hasFormat(const MemoryBuffer &DataBuffer); error_code readHeader() override; diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index c317a457bb..a95d9bc3b0 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -31,9 +31,9 @@ error_code InstrProfReader::create(std::string Path, // 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::readNextRecord(InstrProfRecord &Record) { return success(); } -RawInstrProfReader::RawInstrProfReader(std::unique_ptr &DataBuffer) - : DataBuffer(DataBuffer.release()) { } +RawInstrProfReader::RawInstrProfReader(std::unique_ptr DataBuffer) + : DataBuffer(std::move(DataBuffer)) { } static uint64_t getRawMagic() { return -- cgit v1.2.3