llvm-cov: Implement the preserve-paths flag
authorJustin Bogner <mail@justinbogner.com>
Tue, 4 Feb 2014 10:45:02 +0000 (10:45 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 4 Feb 2014 10:45:02 +0000 (10:45 +0000)
commit01c05505841940a899fbfd3e214b5d3214d80ef6
treeca02f24ac0384d572f18007daf01d5b3339caf91
parent284c931330404e61d548fc1eedf44d5dd1b87507
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
14 files changed:
include/llvm/Support/GCOV.h
lib/IR/GCOV.cpp
test/tools/llvm-cov/Inputs/test_-b.output
test/tools/llvm-cov/Inputs/test_-f.output
test/tools/llvm-cov/Inputs/test_no_gcda.output
test/tools/llvm-cov/Inputs/test_no_options.output
test/tools/llvm-cov/Inputs/test_no_preserve_paths.output [new file with mode: 0644]
test/tools/llvm-cov/Inputs/test_paths.cpp.gcov [new file with mode: 0644]
test/tools/llvm-cov/Inputs/test_paths.gcda [new file with mode: 0644]
test/tools/llvm-cov/Inputs/test_paths.gcno [new file with mode: 0644]
test/tools/llvm-cov/Inputs/test_paths.h.gcov [new file with mode: 0644]
test/tools/llvm-cov/Inputs/test_preserve_paths.output [new file with mode: 0644]
test/tools/llvm-cov/llvm-cov.test
tools/llvm-cov/llvm-cov.cpp