[PATCH] CoverageMapping: Reader - update for the modified profile data format by add function's hash to coverage function records.
Justin Bogner
mail at justinbogner.com
Wed Aug 20 23:40:59 PDT 2014
LGTM.
Alex Lorenz <arphaman at gmail.com> writes:
> Hi bogner, bob.wilson,
>
> Recently, the profile data format was updated to allow for multiple
> functions with the same name. The updated 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. This patch
> updates the CoverageMappingReader which now also stores function
> hashes in function records.
>
> http://reviews.llvm.org/D4994
>
> Files:
> include/llvm/ProfileData/CoverageMappingReader.h
> lib/ProfileData/CoverageMappingReader.cpp
>
> Index: include/llvm/ProfileData/CoverageMappingReader.h
> ===================================================================
> --- include/llvm/ProfileData/CoverageMappingReader.h
> +++ include/llvm/ProfileData/CoverageMappingReader.h
> @@ -33,6 +33,7 @@
> /// \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 @@
> 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:
> Index: lib/ProfileData/CoverageMappingReader.cpp
> ===================================================================
> --- lib/ProfileData/CoverageMappingReader.cpp
> +++ lib/ProfileData/CoverageMappingReader.cpp
> @@ -308,6 +308,7 @@
> 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 @@
> 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 @@
> FunctionsFilenames, Expressions, MappingRegions);
> if (auto Err = Reader.read(Record))
> return Err;
> + Record.FunctionHash = R.FunctionHash;
> ++CurrentRecord;
> return success();
> }
More information about the llvm-commits
mailing list