[PATCH] D63648: [Preprocessor] Honor absolute paths in diagnostics

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 07:58:32 PDT 2019

thakis added a comment.

In D63648#1591469 <https://reviews.llvm.org/D63648#1591469>, @aganea wrote:

> It totally makes sense, thanks for the explanation Nico! Let's forget about `cl` compatibility, that wasn't my initial intent.
> We always pass //relative// paths on the cmd-line, for all the reasons you've mentioned. We also pass `-fdiagnostics-absolute-paths` hoping to fix the Visual Studio jump-to-location issue I've mentioned above. However that doesn't work, because we do:
>   (locally, on my PC)
>     $ clang-cl file.cpp -Isome/relative/path/ -fdiagnostics-absolute-paths /showIncludes -E >file_pre.cpp
>   (and then, on a remote PC)
>     $ clang-cl file_pre.cpp -fdiagnostics-absolute-paths
>   (the remote stdout is then displayed on my PC)
> `-fdiagnostics-absolute-paths` has no effect in the latter case, because the paths are extracted from the preprocessed file, and paths can't be absolutized anymore on the remote PC because it doesn't have the source code (it is only a worker server).
>  So we end with relative paths in diagnostics, and Visual Studio can't jump to the location of the diagnostic.
> What would you suggest? Use absolute paths along with `-fdebug-prefix-map`?

I see, thanks for the details.  A few more questions (sorry!):

- Does fastbuild have something like distcc-pump? (In pump mode, distcc sends the raw cc files and all included headers to the server, and preprocessing happens remotely – http://manpages.ubuntu.com/manpages/bionic/man1/distcc.1.html#how%20distcc-pump%20mode%20works) I think this would address this (?)

- IIRC we used to use fdiagnostics-absolute-paths in Chromium but eventually stopped because someone figured out how to make MSVC's jump-to-diag work even with relative paths (?)

I'm not sure what the Right Fix is here – I can see use cases for `-E` both with relative and with absolute paths, even if `-fdiagnostics-absolute-paths` :-/

I think `-fdebug-prefix-map` doesn't affect `-E` output as far as I know.

  rC Clang



More information about the cfe-commits mailing list