[llvm] r258036 - [Coverage] move a local var to be BinaryCoverageReader's member
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 17 22:48:01 PST 2016
Author: davidxl
Date: Mon Jan 18 00:48:01 2016
New Revision: 258036
URL: http://llvm.org/viewvc/llvm-project?rev=258036&view=rev
Log:
[Coverage] move a local var to be BinaryCoverageReader's member
The symtab is logically referenced beyond the call to the create
method. This changes makes sure its lifetime matches that of
the reader.
Modified:
llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h
llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
Modified: llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h?rev=258036&r1=258035&r2=258036&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h Mon Jan 18 00:48:01 2016
@@ -158,6 +158,7 @@ public:
private:
std::vector<StringRef> Filenames;
std::vector<ProfileMappingRecord> MappingRecords;
+ InstrProfSymtab ProfileNames;
size_t CurrentRecord;
std::vector<StringRef> FunctionsFilenames;
std::vector<CounterExpression> Expressions;
Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=258036&r1=258035&r2=258036&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Mon Jan 18 00:48:01 2016
@@ -546,33 +546,36 @@ BinaryCoverageReader::create(std::unique
StringRef Arch) {
std::unique_ptr<BinaryCoverageReader> Reader(new BinaryCoverageReader());
- InstrProfSymtab ProfileNames;
StringRef Coverage;
uint8_t BytesInAddress;
support::endianness Endian;
std::error_code EC;
if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic))
// This is a special format used for testing.
- EC = loadTestingFormat(ObjectBuffer->getBuffer(), ProfileNames, Coverage,
- BytesInAddress, Endian);
+ EC = loadTestingFormat(ObjectBuffer->getBuffer(), Reader->ProfileNames,
+ Coverage, BytesInAddress, Endian);
else
- EC = loadBinaryFormat(ObjectBuffer->getMemBufferRef(), ProfileNames,
+ EC = loadBinaryFormat(ObjectBuffer->getMemBufferRef(), Reader->ProfileNames,
Coverage, BytesInAddress, Endian, Arch);
if (EC)
return EC;
if (BytesInAddress == 4 && Endian == support::endianness::little)
EC = readCoverageMappingData<uint32_t, support::endianness::little>(
- ProfileNames, Coverage, Reader->MappingRecords, Reader->Filenames);
+ Reader->ProfileNames, Coverage, Reader->MappingRecords,
+ Reader->Filenames);
else if (BytesInAddress == 4 && Endian == support::endianness::big)
EC = readCoverageMappingData<uint32_t, support::endianness::big>(
- ProfileNames, Coverage, Reader->MappingRecords, Reader->Filenames);
+ Reader->ProfileNames, Coverage, Reader->MappingRecords,
+ Reader->Filenames);
else if (BytesInAddress == 8 && Endian == support::endianness::little)
EC = readCoverageMappingData<uint64_t, support::endianness::little>(
- ProfileNames, Coverage, Reader->MappingRecords, Reader->Filenames);
+ Reader->ProfileNames, Coverage, Reader->MappingRecords,
+ Reader->Filenames);
else if (BytesInAddress == 8 && Endian == support::endianness::big)
EC = readCoverageMappingData<uint64_t, support::endianness::big>(
- ProfileNames, Coverage, Reader->MappingRecords, Reader->Filenames);
+ Reader->ProfileNames, Coverage, Reader->MappingRecords,
+ Reader->Filenames);
else
return coveragemap_error::malformed;
if (EC)
More information about the llvm-commits
mailing list