[mlir] [llvm] [llvm][CMake][TableGen] Add all TableGen files to tablegen_compile_commands.yml (PR #71686)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 19:57:24 PST 2023


================
@@ -91,6 +95,29 @@ function(tablegen project ofn)
   # but lets us having smaller and cleaner code here.
   get_directory_property(tblgen_includes INCLUDE_DIRECTORIES)
   list(APPEND tblgen_includes ${ARG_EXTRA_INCLUDES})
+
+  # Get the current set of include paths for this td file.
+  cmake_parse_arguments(ARG "" "" "DEPENDS;EXTRA_INCLUDES" ${ARGN})
+  get_directory_property(tblgen_includes INCLUDE_DIRECTORIES)
+  list(APPEND tblgen_includes ${ARG_EXTRA_INCLUDES})
+  # Filter out any empty include items.
+  list(REMOVE_ITEM tblgen_includes "")
+
+  # Build the absolute path for the current input file.
+  if (IS_ABSOLUTE ${LLVM_TARGET_DEFINITIONS})
+    set(LLVM_TARGET_DEFINITIONS_ABSOLUTE ${LLVM_TARGET_DEFINITIONS})
+  else()
+    set(LLVM_TARGET_DEFINITIONS_ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS})
+  endif()
+
+  # Append the includes used for this file to the tablegen_compile_commands
+  # file.
----------------
joker-eph wrote:

Nit: your comment are saying a lot about "what the code does", but in general it's more helpful to say "why" and provide context (the "what" can generally be read in the code somehow, the context is much harder to infer).

https://github.com/llvm/llvm-project/pull/71686


More information about the llvm-commits mailing list