From 1d45c5bc269cbefe36a43089abf81372ca142613 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 21 Aug 2014 19:25:27 +0000 Subject: Coverage Mapping: store function's hash in 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/D4995 llvm-svn: 216208 --- clang/lib/CodeGen/CoverageMappingGen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp') diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 86e2be8fbe2..1bfa7cda76d 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1094,12 +1094,13 @@ static void dump(llvm::raw_ostream &OS, const CoverageMappingRecord &Function) { void CoverageMappingModuleGen::addFunctionMappingRecord( llvm::GlobalVariable *FunctionName, StringRef FunctionNameValue, - const std::string &CoverageMapping) { + uint64_t FunctionHash, const std::string &CoverageMapping) { llvm::LLVMContext &Ctx = CGM.getLLVMContext(); auto *Int32Ty = llvm::Type::getInt32Ty(Ctx); + auto *Int64Ty = llvm::Type::getInt64Ty(Ctx); auto *Int8PtrTy = llvm::Type::getInt8PtrTy(Ctx); if (!FunctionRecordTy) { - llvm::Type *FunctionRecordTypes[] = {Int8PtrTy, Int32Ty, Int32Ty}; + llvm::Type *FunctionRecordTypes[] = {Int8PtrTy, Int32Ty, Int32Ty, Int64Ty}; FunctionRecordTy = llvm::StructType::get(Ctx, makeArrayRef(FunctionRecordTypes)); } @@ -1107,7 +1108,8 @@ void CoverageMappingModuleGen::addFunctionMappingRecord( llvm::Constant *FunctionRecordVals[] = { llvm::ConstantExpr::getBitCast(FunctionName, Int8PtrTy), llvm::ConstantInt::get(Int32Ty, FunctionNameValue.size()), - llvm::ConstantInt::get(Int32Ty, CoverageMapping.size())}; + llvm::ConstantInt::get(Int32Ty, CoverageMapping.size()), + llvm::ConstantInt::get(Int64Ty, FunctionHash)}; FunctionRecords.push_back(llvm::ConstantStruct::get( FunctionRecordTy, makeArrayRef(FunctionRecordVals))); CoverageMappings += CoverageMapping; -- cgit v1.2.3