[llvm] r274105 - Revert "[Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)"
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 28 22:33:24 PDT 2016
Author: vedantk
Date: Wed Jun 29 00:33:24 2016
New Revision: 274105
URL: http://llvm.org/viewvc/llvm-project?rev=274105&view=rev
Log:
Revert "[Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)"
This reverts commit 1037ef2574adde2103ad221d63834c3e1df4a776.
Modified:
llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp
llvm/trunk/lib/ProfileData/Coverage/CoverageMappingReader.cpp
Modified: llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMappingReader.h?rev=274105&r1=274104&r2=274105&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMappingReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMappingReader.h Wed Jun 29 00:33:24 2016
@@ -181,7 +181,8 @@ private:
public:
static Expected<std::unique_ptr<BinaryCoverageReader>>
- create(MemoryBuffer &ObjectBuffer, StringRef Arch);
+ create(std::unique_ptr<MemoryBuffer> &ObjectBuffer,
+ StringRef Arch);
Error readNextRecord(CoverageMappingRecord &Record) override;
};
Modified: llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp?rev=274105&r1=274104&r2=274105&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp (original)
+++ llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp Wed Jun 29 00:33:24 2016
@@ -236,13 +236,11 @@ CoverageMapping::load(CoverageMappingRea
Expected<std::unique_ptr<CoverageMapping>>
CoverageMapping::load(StringRef ObjectFilename, StringRef ProfileFilename,
StringRef Arch) {
- auto CounterMappingBufOrErr = MemoryBuffer::getFileOrSTDIN(ObjectFilename);
- if (std::error_code EC = CounterMappingBufOrErr.getError())
+ auto CounterMappingBuff = MemoryBuffer::getFileOrSTDIN(ObjectFilename);
+ if (std::error_code EC = CounterMappingBuff.getError())
return errorCodeToError(EC);
- std::unique_ptr<MemoryBuffer> ObjectBuffer =
- std::move(CounterMappingBufOrErr.get());
auto CoverageReaderOrErr =
- BinaryCoverageReader::create(*ObjectBuffer.get(), Arch);
+ BinaryCoverageReader::create(CounterMappingBuff.get(), Arch);
if (Error E = CoverageReaderOrErr.takeError())
return std::move(E);
auto CoverageReader = std::move(CoverageReaderOrErr.get());
Modified: llvm/trunk/lib/ProfileData/Coverage/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/Coverage/CoverageMappingReader.cpp?rev=274105&r1=274104&r2=274105&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/Coverage/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/Coverage/CoverageMappingReader.cpp Wed Jun 29 00:33:24 2016
@@ -641,7 +641,8 @@ static Error loadBinaryFormat(MemoryBuff
}
Expected<std::unique_ptr<BinaryCoverageReader>>
-BinaryCoverageReader::create(MemoryBuffer &ObjectBuffer, StringRef Arch) {
+BinaryCoverageReader::create(std::unique_ptr<MemoryBuffer> &ObjectBuffer,
+ StringRef Arch) {
std::unique_ptr<BinaryCoverageReader> Reader(new BinaryCoverageReader());
StringRef Coverage;
@@ -649,12 +650,12 @@ BinaryCoverageReader::create(MemoryBuffe
support::endianness Endian;
Error E;
consumeError(std::move(E));
- if (ObjectBuffer.getBuffer().startswith(TestingFormatMagic))
+ if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic))
// This is a special format used for testing.
- E = loadTestingFormat(ObjectBuffer.getBuffer(), Reader->ProfileNames,
+ E = loadTestingFormat(ObjectBuffer->getBuffer(), Reader->ProfileNames,
Coverage, BytesInAddress, Endian);
else
- E = loadBinaryFormat(ObjectBuffer.getMemBufferRef(), Reader->ProfileNames,
+ E = loadBinaryFormat(ObjectBuffer->getMemBufferRef(), Reader->ProfileNames,
Coverage, BytesInAddress, Endian, Arch);
if (E)
return std::move(E);
More information about the llvm-commits
mailing list