summaryrefslogtreecommitdiff
path: root/tools/llvm-cov
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-02-04 10:45:02 +0000
committerJustin Bogner <mail@justinbogner.com>2014-02-04 10:45:02 +0000
commit01c05505841940a899fbfd3e214b5d3214d80ef6 (patch)
treeca02f24ac0384d572f18007daf01d5b3339caf91 /tools/llvm-cov
parent284c931330404e61d548fc1eedf44d5dd1b87507 (diff)
downloadllvm-01c05505841940a899fbfd3e214b5d3214d80ef6.tar.gz
llvm-01c05505841940a899fbfd3e214b5d3214d80ef6.tar.bz2
llvm-01c05505841940a899fbfd3e214b5d3214d80ef6.tar.xz
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
Diffstat (limited to 'tools/llvm-cov')
-rw-r--r--tools/llvm-cov/llvm-cov.cpp6
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) {
GF.dump();
GCOVOptions Options(AllBlocks, BranchProb, BranchCount, FuncSummary,
- UncondBranch);
+ PreservePaths, UncondBranch);
FileInfo FI(Options);
GF.collectLineCounts(FI);
FI.print(InputGCNO, InputGCDA);