From 2488e444297f5813613d8fb76fb1f3378fb9171e Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 22 Oct 2020 16:34:19 -0400 Subject: [PATCH] [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 --- llvm/cmake/modules/AddLLVM.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 4f11d2f..2bf071e 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() -- 2.7.4