InstrProf: Rename ObjectFileCoverageMappingReader to BinaryCoverageReader

The current name is long and confusing. A shorter one is both easier
to understand and easier to work with.

llvm-svn: 230675
This commit is contained in:
Justin Bogner 2015-02-26 20:06:24 +00:00
parent b071bee295
commit e84891a459
3 changed files with 10 additions and 12 deletions

View File

@ -142,7 +142,7 @@ private:
/// \brief Reader for the coverage mapping data that is emitted by the /// \brief Reader for the coverage mapping data that is emitted by the
/// frontend and stored in an object file. /// frontend and stored in an object file.
class ObjectFileCoverageMappingReader : public CoverageMappingReader { class BinaryCoverageReader : public CoverageMappingReader {
public: public:
struct ProfileMappingRecord { struct ProfileMappingRecord {
CoverageMappingVersion Version; CoverageMappingVersion Version;
@ -170,10 +170,8 @@ private:
std::vector<CounterExpression> Expressions; std::vector<CounterExpression> Expressions;
std::vector<CounterMappingRegion> MappingRegions; std::vector<CounterMappingRegion> MappingRegions;
ObjectFileCoverageMappingReader(const ObjectFileCoverageMappingReader &) BinaryCoverageReader(const BinaryCoverageReader &) = delete;
= delete; BinaryCoverageReader &operator=(const BinaryCoverageReader &) = delete;
ObjectFileCoverageMappingReader &
operator=(const ObjectFileCoverageMappingReader &) = delete;
/// \brief Set the current error_code and return same. /// \brief Set the current error_code and return same.
std::error_code error(std::error_code EC) { std::error_code error(std::error_code EC) {
@ -185,7 +183,7 @@ private:
std::error_code success() { return error(instrprof_error::success); } std::error_code success() { return error(instrprof_error::success); }
public: public:
ObjectFileCoverageMappingReader(std::unique_ptr<MemoryBuffer> &ObjectBuffer); BinaryCoverageReader(std::unique_ptr<MemoryBuffer> &ObjectBuffer);
std::error_code readHeader(); std::error_code readHeader();
std::error_code readNextRecord(CoverageMappingRecord &Record) override; std::error_code readNextRecord(CoverageMappingRecord &Record) override;

View File

@ -221,7 +221,7 @@ CoverageMapping::load(StringRef ObjectFilename, StringRef ProfileFilename) {
auto CounterMappingBuff = MemoryBuffer::getFileOrSTDIN(ObjectFilename); auto CounterMappingBuff = MemoryBuffer::getFileOrSTDIN(ObjectFilename);
if (auto EC = CounterMappingBuff.getError()) if (auto EC = CounterMappingBuff.getError())
return EC; return EC;
ObjectFileCoverageMappingReader CoverageReader(CounterMappingBuff.get()); BinaryCoverageReader CoverageReader(CounterMappingBuff.get());
if (auto EC = CoverageReader.readHeader()) if (auto EC = CoverageReader.readHeader())
return EC; return EC;
auto ProfileReaderOrErr = IndexedInstrProfReader::create(ProfileFilename); auto ProfileReaderOrErr = IndexedInstrProfReader::create(ProfileFilename);

View File

@ -334,7 +334,7 @@ struct SectionData {
template <typename T> template <typename T>
std::error_code readCoverageMappingData( std::error_code readCoverageMappingData(
SectionData &ProfileNames, StringRef Data, SectionData &ProfileNames, StringRef Data,
std::vector<ObjectFileCoverageMappingReader::ProfileMappingRecord> &Records, std::vector<BinaryCoverageReader::ProfileMappingRecord> &Records,
std::vector<StringRef> &Filenames) { std::vector<StringRef> &Filenames) {
llvm::DenseSet<T> UniqueFunctionMappingData; llvm::DenseSet<T> UniqueFunctionMappingData;
@ -400,7 +400,7 @@ std::error_code readCoverageMappingData(
ProfileNames.get(MappingRecord.FunctionNamePtr, ProfileNames.get(MappingRecord.FunctionNamePtr,
MappingRecord.FunctionNameSize, FunctionName)) MappingRecord.FunctionNameSize, FunctionName))
return Err; return Err;
Records.push_back(ObjectFileCoverageMappingReader::ProfileMappingRecord( Records.push_back(BinaryCoverageReader::ProfileMappingRecord(
Version, FunctionName, MappingRecord.FunctionHash, Mapping, Version, FunctionName, MappingRecord.FunctionHash, Mapping,
FilenamesBegin, Filenames.size() - FilenamesBegin)); FilenamesBegin, Filenames.size() - FilenamesBegin));
} }
@ -438,7 +438,7 @@ static std::error_code decodeTestingFormat(StringRef Data,
return instrprof_error::success; return instrprof_error::success;
} }
ObjectFileCoverageMappingReader::ObjectFileCoverageMappingReader( BinaryCoverageReader::BinaryCoverageReader(
std::unique_ptr<MemoryBuffer> &ObjectBuffer) std::unique_ptr<MemoryBuffer> &ObjectBuffer)
: CurrentRecord(0) { : CurrentRecord(0) {
if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic)) { if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic)) {
@ -466,7 +466,7 @@ ObjectFileCoverageMappingReader::ObjectFileCoverageMappingReader(
std::move(ObjectBuffer)); std::move(ObjectBuffer));
} }
std::error_code ObjectFileCoverageMappingReader::readHeader() { std::error_code BinaryCoverageReader::readHeader() {
const ObjectFile *OF = Object.getBinary(); const ObjectFile *OF = Object.getBinary();
if (!OF) if (!OF)
return getError(); return getError();
@ -515,7 +515,7 @@ std::error_code ObjectFileCoverageMappingReader::readHeader() {
} }
std::error_code std::error_code
ObjectFileCoverageMappingReader::readNextRecord(CoverageMappingRecord &Record) { BinaryCoverageReader::readNextRecord(CoverageMappingRecord &Record) {
if (CurrentRecord >= MappingRecords.size()) if (CurrentRecord >= MappingRecords.size())
return error(instrprof_error::eof); return error(instrprof_error::eof);