]> granicus.if.org Git - clang/commitdiff
Emit .gcda files as absolute paths instead of relative paths.
authorBill Wendling <isanbard@gmail.com>
Thu, 30 Aug 2012 00:43:41 +0000 (00:43 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 30 Aug 2012 00:43:41 +0000 (00:43 +0000)
This improves compatibility with gcc in this regard, and this file generation
can be ameliorated with GCOV_PREFIX and GCOV_PREFIX_STRIP. It's also useful if
your build directory doesn't specify -o <abspath> and it uses a recursive make
structure, so it's not relative to the toplevel.

Patch by Joshua Cranmer!
<rdar://problem/12179524>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162884 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index 4336d9ee261305952598df8a82757f8038776142..c113406670ba6bec21218877bfca53a5ec43e0ae 100644 (file)
@@ -2015,7 +2015,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       C.getArgs().hasArg(options::OPT_S)) {
     if (Output.isFilename()) {
       CmdArgs.push_back("-coverage-file");
-      CmdArgs.push_back(Args.MakeArgString(Output.getFilename()));
+      SmallString<128> absFilename(Output.getFilename());
+      llvm::sys::fs::make_absolute(absFilename);
+      CmdArgs.push_back(Args.MakeArgString(absFilename));
     }
   }