From: Bill Wendling Date: Thu, 30 Aug 2012 00:43:41 +0000 (+0000) Subject: Emit .gcda files as absolute paths instead of relative paths. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ecbbea47659c13ef4193879001f606868757007e;p=clang Emit .gcda files as absolute paths instead of relative paths. 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 and it uses a recursive make structure, so it's not relative to the toplevel. Patch by Joshua Cranmer! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162884 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 4336d9ee26..c113406670 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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)); } }