[PATCH] D77184: Make it possible for lit.site.cfg to contain relative paths, and use it for llvm and clang

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 20:02:30 PDT 2020


rsmith added a comment.

In D77184#1961208 <https://reviews.llvm.org/D77184#1961208>, @rsmith wrote:

> This has broken my ability to run the `check-clang` target on Linux. There are symlinks in the path from which I run my builds, and this patch is computing incorrect relative paths in that situation.


This patch appears to fix the problem:

  diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
  index e0ceb364c3e..10010ce8caa 100644
  --- a/llvm/cmake/modules/AddLLVM.cmake
  +++ b/llvm/cmake/modules/AddLLVM.cmake
  @@ -1505,7 +1505,7 @@ drive = os.path.splitdrive(sys.argv[1])[0]\n
   def relpath(p):\n
       if not p: return ''\n
       if os.path.splitdrive(p)[0] != drive: return p\n
  -    return os.path.relpath(p, sys.argv[1]).replace(os.sep, '/')\n
  +    return os.path.relpath(os.path.realpath(p), os.path.realpath(sys.argv[1])).replace(os.sep, '/')\n
   sys.stdout.write(';'.join(relpath(p) for p in sys.argv[2].split(';')))"
         ${OUTPUT_DIR}
         ${ARG_PATH_VALUES_ESCAPED}


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77184/new/

https://reviews.llvm.org/D77184





More information about the cfe-commits mailing list