From 01c05505841940a899fbfd3e214b5d3214d80ef6 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 4 Feb 2014 10:45:02 +0000 Subject: llvm-cov: Implement the preserve-paths flag Until now, when a path in a gcno file included a directory, we would emit our .gcov file in that directory, whereas gcov always emits the file in the current directory. In doing so, this implements gcov's strange name-mangling -p flag, which is needed to avoid clobbering files when two with the same name exist in different directories. The path mangling is a bit ugly and only handles unix-like paths, but it's simple, and it doesn't make any guesses as to how it should behave outside of what gcov documents. If we decide this should be cross platform later, we can consider the compatibility implications then. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200754 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/GCOV.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index 4e7920b8e9..aeac4555ce 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -37,14 +37,15 @@ namespace GCOV { /// GCOVOptions - A struct for passing gcov options between functions. struct GCOVOptions { - GCOVOptions(bool A, bool B, bool C, bool F, bool U) : - AllBlocks(A), BranchInfo(B), BranchCount(C), FuncCoverage(F), UncondBranch(U) - {} + GCOVOptions(bool A, bool B, bool C, bool F, bool P, bool U) + : AllBlocks(A), BranchInfo(B), BranchCount(C), FuncCoverage(F), + PreservePaths(P), UncondBranch(U) {} bool AllBlocks; bool BranchInfo; bool BranchCount; bool FuncCoverage; + bool PreservePaths; bool UncondBranch; }; @@ -401,8 +402,13 @@ private: StringMap LineInfo; uint32_t RunCount; uint32_t ProgramCount; - SmallVector FileCoverages; - MapVector FuncCoverages; + + typedef SmallVector, 4> + FileCoverageList; + typedef MapVector FuncCoverageMap; + + FileCoverageList FileCoverages; + FuncCoverageMap FuncCoverages; }; } -- cgit v1.2.3