mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
InstrProf: Use move semantics with unique_ptr
<rdar://problem/15950346> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bb56c4808e
commit
bc2740a598
@ -113,8 +113,8 @@ private:
|
|||||||
TextInstrProfReader &operator=(const TextInstrProfReader &)
|
TextInstrProfReader &operator=(const TextInstrProfReader &)
|
||||||
LLVM_DELETED_FUNCTION;
|
LLVM_DELETED_FUNCTION;
|
||||||
public:
|
public:
|
||||||
TextInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer_)
|
TextInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer_)
|
||||||
: DataBuffer(DataBuffer_.release()), Line(*DataBuffer, '#') {}
|
: DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, '#') {}
|
||||||
|
|
||||||
/// Read the header.
|
/// Read the header.
|
||||||
error_code readHeader() override { return success(); }
|
error_code readHeader() override { return success(); }
|
||||||
@ -161,7 +161,7 @@ private:
|
|||||||
RawInstrProfReader &operator=(const TextInstrProfReader &)
|
RawInstrProfReader &operator=(const TextInstrProfReader &)
|
||||||
LLVM_DELETED_FUNCTION;
|
LLVM_DELETED_FUNCTION;
|
||||||
public:
|
public:
|
||||||
RawInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer);
|
RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer);
|
||||||
|
|
||||||
static bool hasFormat(const MemoryBuffer &DataBuffer);
|
static bool hasFormat(const MemoryBuffer &DataBuffer);
|
||||||
error_code readHeader() override;
|
error_code readHeader() override;
|
||||||
|
@ -31,9 +31,9 @@ error_code InstrProfReader::create(std::string Path,
|
|||||||
|
|
||||||
// Create the reader.
|
// Create the reader.
|
||||||
if (RawInstrProfReader::hasFormat(*Buffer))
|
if (RawInstrProfReader::hasFormat(*Buffer))
|
||||||
Result.reset(new RawInstrProfReader(Buffer));
|
Result.reset(new RawInstrProfReader(std::move(Buffer)));
|
||||||
else
|
else
|
||||||
Result.reset(new TextInstrProfReader(Buffer));
|
Result.reset(new TextInstrProfReader(std::move(Buffer)));
|
||||||
|
|
||||||
// Read the header and return the result.
|
// Read the header and return the result.
|
||||||
return Result->readHeader();
|
return Result->readHeader();
|
||||||
@ -85,8 +85,8 @@ error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) {
|
|||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> &DataBuffer)
|
RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer)
|
||||||
: DataBuffer(DataBuffer.release()) { }
|
: DataBuffer(std::move(DataBuffer)) { }
|
||||||
|
|
||||||
static uint64_t getRawMagic() {
|
static uint64_t getRawMagic() {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user