Coverage Mapping: add function's hash to coverage function records.

The profile data format was recently updated and the new indexing api
requires the code coverage tool to know the function's hash as well
as the function's name to get the execution counts for a function.

Differential Revision: http://reviews.llvm.org/D4994


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz 2014-08-21 19:23:25 +00:00
parent 9ca2a9ae4e
commit 93695d2395
2 changed files with 10 additions and 6 deletions

View File

@ -33,6 +33,7 @@ class ObjectFileCoverageMappingReader;
/// \brief Coverage mapping information for a single function.
struct CoverageMappingRecord {
StringRef FunctionName;
uint64_t FunctionHash;
ArrayRef<StringRef> Filenames;
ArrayRef<CounterExpression> Expressions;
ArrayRef<CounterMappingRegion> MappingRegions;
@ -143,16 +144,17 @@ public:
struct ProfileMappingRecord {
CoverageMappingVersion Version;
StringRef FunctionName;
uint64_t FunctionHash;
StringRef CoverageMapping;
size_t FilenamesBegin;
size_t FilenamesSize;
ProfileMappingRecord(CoverageMappingVersion Version, StringRef FunctionName,
StringRef CoverageMapping, size_t FilenamesBegin,
size_t FilenamesSize)
uint64_t FunctionHash, StringRef CoverageMapping,
size_t FilenamesBegin, size_t FilenamesSize)
: Version(Version), FunctionName(FunctionName),
CoverageMapping(CoverageMapping), FilenamesBegin(FilenamesBegin),
FilenamesSize(FilenamesSize) {}
FunctionHash(FunctionHash), CoverageMapping(CoverageMapping),
FilenamesBegin(FilenamesBegin), FilenamesSize(FilenamesSize) {}
};
private:

View File

@ -308,6 +308,7 @@ template <typename IntPtrT> struct CoverageMappingFunctionRecord {
IntPtrT FunctionNamePtr;
uint32_t FunctionNameSize;
uint32_t CoverageMappingSize;
uint64_t FunctionHash;
};
/// \brief The coverage mapping data for a single translation unit.
@ -422,8 +423,8 @@ std::error_code readCoverageMappingData(
FunctionName))
return Err;
Records.push_back(ObjectFileCoverageMappingReader::ProfileMappingRecord(
Version, FunctionName, Mapping, FilenamesBegin,
Filenames.size() - FilenamesBegin));
Version, FunctionName, MappingRecord.FunctionHash, Mapping,
FilenamesBegin, Filenames.size() - FilenamesBegin));
}
}
@ -485,6 +486,7 @@ ObjectFileCoverageMappingReader::readNextRecord(CoverageMappingRecord &Record) {
FunctionsFilenames, Expressions, MappingRegions);
if (auto Err = Reader.read(Record))
return Err;
Record.FunctionHash = R.FunctionHash;
++CurrentRecord;
return success();
}