[PATCH] D81797: [CMake] Return empty list from 'make_paths_relative' if passed 'pathlist' is empty.

Vlad Vereschaka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 13 14:57:28 PDT 2020


vvereschaka created this revision.
vvereschaka added a reviewer: thakis.
Herald added subscribers: llvm-commits, kristof.beyls, mgorny.
Herald added a project: LLVM.

Check passed 'pathlist' parameter and return an empty list if the 'pathlist' parameter is empty.
Otherwise the python script raises unattended error on empty parameter. The error message looks like:

  Traceback (most recent call last):
   	 File "<string>", line 22, in <module>
  IndexError: list index out of range

see more details here http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/9476/steps/build-llvm-project/logs/stdio


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81797

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1485,6 +1485,10 @@
 # contain symlinks are returned absolute.
 # Use with LLVM_LIT_PATH_FUNCTION below.
 function(make_paths_relative out_pathlist basedir pathlist)
+  if (NOT pathlist)
+    set(${out_pathlist} "" PARENT_SCOPE)
+    return()
+  endif()
   # Passing ARG_PATH_VALUES as-is to execute_process() makes cmake strip
   # empty list entries. So escape the ;s in the list and do the splitting
   # ourselves. cmake has no relpath function, so use Python for that.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81797.270589.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200613/a7814e2b/attachment.bin>


More information about the llvm-commits mailing list