path: root/tools/llvm-cov
diff options
authorJustin Bogner <>2014-02-04 10:45:02 +0000
committerJustin Bogner <>2014-02-04 10:45:02 +0000
commit01c05505841940a899fbfd3e214b5d3214d80ef6 (patch)
treeca02f24ac0384d572f18007daf01d5b3339caf91 /tools/llvm-cov
parent284c931330404e61d548fc1eedf44d5dd1b87507 (diff)
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: 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-cov')
1 files changed, 5 insertions, 1 deletions
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<std::string> 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<bool> PreservePaths("p", cl::init(false),
+ cl::desc("Preserve path components"));
+static cl::alias PreservePathsA("preserve-paths", cl::aliasopt(PreservePaths));
static cl::opt<bool> UncondBranch("u", cl::init(false),
cl::desc("Display unconditional branch info "
"(requires -b)"));
@@ -113,7 +117,7 @@ int main(int argc, char **argv) {
GCOVOptions Options(AllBlocks, BranchProb, BranchCount, FuncSummary,
- UncondBranch);
+ PreservePaths, UncondBranch);
FileInfo FI(Options);
FI.print(InputGCNO, InputGCDA);