[llvm] 18a18b2 - Fix standalone clang builds after fb80b6b2d58.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 14:16:28 PDT 2020


Author: Nico Weber
Date: 2020-04-03T17:15:09-04:00
New Revision: 18a18b20017d8d6d907ce409f0dc9585cec8bf72

URL: https://github.com/llvm/llvm-project/commit/18a18b20017d8d6d907ce409f0dc9585cec8bf72
DIFF: https://github.com/llvm/llvm-project/commit/18a18b20017d8d6d907ce409f0dc9585cec8bf72.diff

LOG: Fix standalone clang builds after fb80b6b2d58.

When clang is built against a prebuilt LLVM, LLVM_SOURCE_DIR is
empty, which due to a cmake quirk caused list lengths to get out
of sync. Add a workaround.

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 8be19b12ed4f..e0ceb364c3ea 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1484,9 +1484,14 @@ function(configure_lit_site_cfg site_in site_out)
 
   if (ARG_PATHS)
     # Walk ARG_PATHS and collect the current value of the variables in there.
+    # list(APPEND) ignores empty elements exactly if the list is empty,
+    # so start the list with a dummy element and drop it, to make sure that
+    # even empty values make it into the values list.
+    set(ARG_PATH_VALUES "dummy")
     foreach(path ${ARG_PATHS})
       list(APPEND ARG_PATH_VALUES "${${path}}")
     endforeach()
+    list(REMOVE_AT ARG_PATH_VALUES 0)
 
     # Compute paths relative to the directory containing output lit.site.cfg.py.
     # Passing ARG_PATH_VALUES as-is to execute_process() makes cmake strip


        


More information about the llvm-commits mailing list