InstrProf: Simplify RawCoverageMappingReader's API slightly

This is still kind of a weird API, but dropping the (partial) update
of the passed in CoverageMappingRecord makes it a little easier to
understand and use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227900 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner
2015-02-03 00:20:11 +00:00
parent 11f57c9068
commit 68697579bf
2 changed files with 12 additions and 11 deletions

View File

@ -221,7 +221,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
return success();
}
std::error_code RawCoverageMappingReader::read(CoverageMappingRecord &Record) {
std::error_code RawCoverageMappingReader::read() {
// Read the virtual file mapping.
llvm::SmallVector<unsigned, 8> VirtualFileMapping;
@ -287,10 +287,6 @@ std::error_code RawCoverageMappingReader::read(CoverageMappingRecord &Record) {
}
}
Record.FunctionName = FunctionName;
Record.Filenames = Filenames;
Record.Expressions = Expressions;
Record.MappingRegions = MappingRegions;
return success();
}
@ -542,12 +538,18 @@ ObjectFileCoverageMappingReader::readNextRecord(CoverageMappingRecord &Record) {
MappingRegions.clear();
auto &R = MappingRecords[CurrentRecord];
RawCoverageMappingReader Reader(
R.FunctionName, R.CoverageMapping,
R.CoverageMapping,
makeArrayRef(Filenames).slice(R.FilenamesBegin, R.FilenamesSize),
FunctionsFilenames, Expressions, MappingRegions);
if (auto Err = Reader.read(Record))
if (auto Err = Reader.read())
return Err;
Record.FunctionName = R.FunctionName;
Record.FunctionHash = R.FunctionHash;
Record.Filenames = FunctionsFilenames;
Record.Expressions = Expressions;
Record.MappingRegions = MappingRegions;
++CurrentRecord;
return success();
}