summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-21 20:42:34 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-21 20:42:34 +0000
commit4c5b7cb1fca96d354d355aa633c1bf2f2da76ea4 (patch)
treea068036eef80cc66fa296640f9e1981cabacb052
parent09a67f45eeaabe9e0ce021ac329e19fed1feb79f (diff)
downloadbcm5719-llvm-4c5b7cb1fca96d354d355aa633c1bf2f2da76ea4.tar.gz
bcm5719-llvm-4c5b7cb1fca96d354d355aa633c1bf2f2da76ea4.zip
InstrProf: Use move semantics with unique_ptr
<rdar://problem/15950346> llvm-svn: 204512
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfReader.h6
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp8
2 files changed, 7 insertions, 7 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index 3cfbf805a5f..d236fecdb63 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -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;
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index c317a457bb6..a95d9bc3b08 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/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<MemoryBuffer> &DataBuffer)
- : DataBuffer(DataBuffer.release()) { }
+RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer)
+ : DataBuffer(std::move(DataBuffer)) { }
static uint64_t getRawMagic() {
return
OpenPOWER on IntegriCloud