[llvm] r216207 - Coverage Mapping: add function's hash to coverage function records.

Alex Lorenz arphaman at gmail.com
Thu Aug 21 12:23:25 PDT 2014


Author: arphaman
Date: Thu Aug 21 14:23:25 2014
New Revision: 216207

URL: http://llvm.org/viewvc/llvm-project?rev=216207&view=rev
Log:
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

Modified:
    llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h
    llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp

Modified: llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h?rev=216207&r1=216206&r2=216207&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/CoverageMappingReader.h Thu Aug 21 14:23:25 2014
@@ -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:

Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=216207&r1=216206&r2=216207&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Thu Aug 21 14:23:25 2014
@@ -308,6 +308,7 @@ template <typename IntPtrT> struct Cover
   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::readNex
       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