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 --- tools/llvm-cov/llvm-cov.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp index 61bee43d82..d7162c4688 100644 --- a/tools/llvm-cov/llvm-cov.cpp +++ b/tools/llvm-cov/llvm-cov.cpp @@ -47,6 +47,10 @@ static cl::opt ObjectDir("o", cl::value_desc("DIR"), cl::init(""), cl::desc("Search for objects in DIR")); static cl::alias ObjectDirA("object-directory", cl::aliasopt(ObjectDir)); +static cl::opt PreservePaths("p", cl::init(false), + cl::desc("Preserve path components")); +static cl::alias PreservePathsA("preserve-paths", cl::aliasopt(PreservePaths)); + static cl::opt UncondBranch("u", cl::init(false), cl::desc("Display unconditional branch info " "(requires -b)")); @@ -113,7 +117,7 @@ int main(int argc, char **argv) { GF.dump(); GCOVOptions Options(AllBlocks, BranchProb, BranchCount, FuncSummary, - UncondBranch); + PreservePaths, UncondBranch); FileInfo FI(Options); GF.collectLineCounts(FI); FI.print(InputGCNO, InputGCDA); -- cgit v1.2.3