aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-03-07 08:28:53 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-03-07 08:28:53 +0000
commit0f815f1f91e5cf0726fd8296445038fec3bed80b (patch)
treeedf1781fad51e0e2894370c40ac62d75c015511e /lib/Driver/Tools.cpp
parent018e9aa033ff7363797c62fc3b14669d0558284b (diff)
Add flags for additional control over coverage generation. Pick the version
string to be emitted, and two properties about the files themselves. Use $PWD to absolut-ify the path to the coverage file. Yes, this is what GCC does. Reverts my own r175706. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 5dce1ad9e2..62b1febd52 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2332,8 +2332,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Output.isFilename()) {
CmdArgs.push_back("-coverage-file");
SmallString<128> CoverageFilename(Output.getFilename());
- if (!C.getArgs().hasArg(options::OPT_no_canonical_prefixes))
- llvm::sys::fs::make_absolute(CoverageFilename);
+ if (llvm::sys::path::is_relative(CoverageFilename.str())) {
+ if (const char *pwd = ::getenv("PWD")) {
+ if (llvm::sys::path::is_absolute(pwd)) {
+ SmallString<128> Pwd(pwd);
+ llvm::sys::path::append(Pwd, CoverageFilename.str());
+ CoverageFilename.swap(Pwd);
+ }
+ }
+ }
CmdArgs.push_back(Args.MakeArgString(CoverageFilename));
}
}