[PATCH] D89985: [llvm-lit] Improve the error message when make_paths_relative() fails
Louis Dionne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 13:46:43 PDT 2020
ldionne created this revision.
ldionne added a reviewer: thakis.
Herald added subscribers: llvm-commits, jkorous, mgorny.
Herald added a project: LLVM.
ldionne requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89985
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1498,7 +1498,12 @@
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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89985.300095.patch
Type: text/x-patch
Size: 673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201022/c6949176/attachment.bin>
More information about the llvm-commits
mailing list