[PATCH] Fix tablegen cmake rule.

James Y Knight jyknight at google.com
Fri May 8 08:20:31 PDT 2015


Hi rnk,

Unlike GNU Make, Ninja will not remove a rule's output file if the
command exits uncleanly; do so manually.

Without this, the *next* ninja run will assume that the 0-byte file
that was left behind was a valid build artifact, attempt to continue
the rest of the build, and fail compilation with very mysterious
errors later on.

http://reviews.llvm.org/D9608

Files:
  cmake/modules/TableGen.cmake

Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -28,7 +28,8 @@
     COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
     -I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
     ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
-    -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+    -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp ||
+    { rm -f ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp && false \; }
     # The file in LLVM_TARGET_DEFINITIONS may be not in the current
     # directory and local_tds may not contain it, so we must
     # explicitly list it here:

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9608.25334.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150508/219007ff/attachment.bin>


More information about the llvm-commits mailing list