[all-commits] [llvm/llvm-project] d22944: [cmake] Fix relative paths in prefix map (#74132)

Paul Kirth via All-commits all-commits at lists.llvm.org
Fri Dec 1 14:51:39 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d22944d1cc54a3384a88d654d144ef62a693df16
      https://github.com/llvm/llvm-project/commit/d22944d1cc54a3384a88d654d144ef62a693df16
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2023-12-01 (Fri, 01 Dec 2023)

  Changed paths:
    M llvm/cmake/modules/HandleLLVMOptions.cmake

  Log Message:
  -----------
  [cmake] Fix relative paths in prefix map (#74132)

When building debug version of LLVM with
`LLVM_USE_RELATIVE_PATHS_IN_FILES=On` would cause source paths to be
incorrect, and be prefixed by the build directory. This lead to source
locations like the following: `../build/llvm/...`. Such paths do not
exist, and existing debuggers can't adjust their search location because
of the incorrect prefix. Ultimately, this happened because the relative
path creation goes in the wrong direction, from source-dir to build-dir
instead of from build-dir to source-dir.

This patch swaps the directionality of the relative paths so that they
get a proper prefix from the build directory. Given a build dir at
`/build` and a project directory at `/llvm-project`, we get source
locations like: `../llvm-project/llvm/lib/Transforms/...`, which a
debugger can resolve once pointed to the correct project directory.




More information about the All-commits mailing list