forked from OSchip/llvm-project
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. llvm-svn: 227900
This commit is contained in:
parent
926af0cdcb
commit
195a4f08ea
|
@ -104,7 +104,6 @@ public:
|
|||
|
||||
/// \brief Reader for the raw coverage mapping data.
|
||||
class RawCoverageMappingReader : public RawCoverageReader {
|
||||
StringRef FunctionName;
|
||||
ArrayRef<StringRef> TranslationUnitFilenames;
|
||||
std::vector<StringRef> &Filenames;
|
||||
std::vector<CounterExpression> &Expressions;
|
||||
|
@ -116,17 +115,17 @@ class RawCoverageMappingReader : public RawCoverageReader {
|
|||
operator=(const RawCoverageMappingReader &) LLVM_DELETED_FUNCTION;
|
||||
|
||||
public:
|
||||
RawCoverageMappingReader(StringRef FunctionName, StringRef MappingData,
|
||||
RawCoverageMappingReader(StringRef MappingData,
|
||||
ArrayRef<StringRef> TranslationUnitFilenames,
|
||||
std::vector<StringRef> &Filenames,
|
||||
std::vector<CounterExpression> &Expressions,
|
||||
std::vector<CounterMappingRegion> &MappingRegions)
|
||||
: RawCoverageReader(MappingData), FunctionName(FunctionName),
|
||||
: RawCoverageReader(MappingData),
|
||||
TranslationUnitFilenames(TranslationUnitFilenames),
|
||||
Filenames(Filenames), Expressions(Expressions),
|
||||
MappingRegions(MappingRegions) {}
|
||||
|
||||
std::error_code read(CoverageMappingRecord &Record);
|
||||
std::error_code read();
|
||||
|
||||
private:
|
||||
std::error_code decodeCounter(unsigned Value, Counter &C);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue