[llvm] r201229 - Teach tablegen() macro to check needed variables

NAKAMURA Takumi geek4civic at gmail.com
Wed Feb 12 03:50:11 PST 2014


Author: chapuni
Date: Wed Feb 12 05:50:11 2014
New Revision: 201229

URL: http://llvm.org/viewvc/llvm-project?rev=201229&view=rev
Log:
Teach tablegen() macro to check needed variables

This macro depends on several variables to be set in the calling
context.  Check them and report an error if they are not set.
Without this, custom commands may be silently specified that
will fail at build time.

Patch by Brad King.

Modified:
    llvm/trunk/cmake/modules/TableGen.cmake

Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=201229&r1=201228&r2=201229&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Wed Feb 12 05:50:11 2014
@@ -3,6 +3,17 @@
 # Adds the name of the generated file to TABLEGEN_OUTPUT.
 
 function(tablegen project ofn)
+  # Validate calling context.
+  foreach(v
+      ${project}_TABLEGEN_EXE
+      LLVM_MAIN_SRC_DIR
+      LLVM_MAIN_INCLUDE_DIR
+      )
+    if(NOT ${v})
+      message(FATAL_ERROR "${v} not set")
+    endif()
+  endforeach()
+
   file(GLOB local_tds "*.td")
   file(GLOB_RECURSE global_tds "${LLVM_MAIN_INCLUDE_DIR}/llvm/*.td")
 





More information about the llvm-commits mailing list