[llvm] 2488e44 - [llvm-lit] Improve the error message when make_paths_relative() fails

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 14:06:45 PDT 2020


Author: Louis Dionne
Date: 2020-10-28T17:06:18-04:00
New Revision: 2488e444297f5813613d8fb76fb1f3378fb9171e

URL: https://github.com/llvm/llvm-project/commit/2488e444297f5813613d8fb76fb1f3378fb9171e
DIFF: https://github.com/llvm/llvm-project/commit/2488e444297f5813613d8fb76fb1f3378fb9171e.diff

LOG: [llvm-lit] Improve the error message when make_paths_relative() fails

Previously, if make_paths_relative() failed due to some reason, it would
happily keep going and set the ${out_pathlist} to the standard output
of the command, which would be the empty string if the command failed.

This can lead to issues that are difficult to diagnose, since the calling
code will usually try to keep going with a variable that was set to the
empty string.

Differential Revision: https://reviews.llvm.org/D89985

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 4f11d2f2bda4..2bf071e61d62 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1500,7 +1500,12 @@ if len(sys.argv) < 3: sys.exit(0)\n
 sys.stdout.write(';'.join(relpath(p) for p in sys.argv[2].split(';')))"
     ${basedir}
     ${pathlist_escaped}
-    OUTPUT_VARIABLE pathlist_relative)
+    OUTPUT_VARIABLE pathlist_relative
+    ERROR_VARIABLE error
+    RESULT_VARIABLE result)
+  if (NOT result EQUAL 0)
+    message(FATAL_ERROR "make_paths_relative() failed due to error '${result}', with stderr\n${error}")
+  endif()
   set(${out_pathlist} "${pathlist_relative}" PARENT_SCOPE)
 endfunction()
 


        


More information about the llvm-commits mailing list