[cfe-commits] [PATCH] Emit .gcda files as absolute paths instead of relative paths

Bill Wendling wendling at apple.com
Wed Aug 29 17:37:49 PDT 2012


Joshua,

This patch looks good to me, and it fixes a problem that recently came up. :-) Thanks!

-bw

On Aug 27, 2012, at 9:52 AM, Joshua Cranmer <pidgeot18 at gmail.com> wrote:

> # HG changeset patch
> # User Joshua Cranmer <Pidgeot18 at gmail.com>
> # Date 1346086230 18000
> # Node ID f883895b212625f650d206d9fa55d03347fdc42b
> # Parent  f2113e659ed60f3ba13e5f979eacb98a60d42ade
> 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 <abspath> and it uses a recursive make
> structure, so it's not relative to the toplevel.
> 
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -2007,17 +2007,19 @@ void Clang::ConstructJob(Compilation &C,
>   if (Args.hasArg(options::OPT_fprofile_arcs) ||
>       Args.hasArg(options::OPT_coverage))
>     CmdArgs.push_back("-femit-coverage-data");
> 
>   if (C.getArgs().hasArg(options::OPT_c) ||
>       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));
>     }
>   }
> 
>   // Pass options for controlling the default header search paths.
>   if (Args.hasArg(options::OPT_nostdinc)) {
>     CmdArgs.push_back("-nostdsysteminc");
>     CmdArgs.push_back("-nobuiltininc");
>   } else {
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list