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

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 07:01:30 PDT 2019

aganea added a comment.

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`?

  rC Clang



More information about the cfe-commits mailing list