summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/llvm-cov.cpp
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
commitc6af3506980bdd215de3787cd72d6f8c22d57099 (patch)
tree9dcab9f688d94f7fe2a9dd22689b38eae5592664 /llvm/tools/llvm-cov/llvm-cov.cpp
parentad560c4c1170f3c6aee3103279df2566d72e9090 (diff)
downloadbcm5719-llvm-c6af3506980bdd215de3787cd72d6f8c22d57099.tar.gz
bcm5719-llvm-c6af3506980bdd215de3787cd72d6f8c22d57099.zip
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. llvm-svn: 200754
Diffstat (limited to 'llvm/tools/llvm-cov/llvm-cov.cpp')
-rw-r--r--llvm/tools/llvm-cov/llvm-cov.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp
index 61bee43d820..d7162c46882 100644
--- a/llvm/tools/llvm-cov/llvm-cov.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud