Skip to content

Commit ed4328c

Browse files
committed
Fix missing build dependency on omp_gen.
Summary: `include/llvm/Frontend/OpenMP/CMakeLists.txt` creates a new target called `omp_gen`, which is automatically added to `LLVM_COMMON_DEPENDS` by the `add_public_tablegen_target` macro. But it only gets added to the version of `LLVM_COMMON_DEPENDS` in the scope of that subsidiary CMakeLists file, and it doesn't propagate all the way back up to the permanent version of that variable which is actually used to set dependencies. The visible effect is that the output build scripts contain a missing dependency. For example, if I run cmake in Ninja output mode, and then run ninja -t commands tools/clang/examples/PrintFunctionNames/CMakeFiles/PrintFunctionNames.dir/PrintFunctionNames.cpp.o to list all the commands that are prerequisites of building that object file, then the list does not include the llvm-tblgen command that builds `include/llvm/Frontend/OpenMP/OMP.h.inc`, even though that generated include file is needed (by a chain of includes starting from `clang/AST/AST.h`), and that object file can't be compiled without it. This missing dependency can cause intermittent build failures, depending on the order that Ninja (or whatever) happens to schedule its commands. I've fixed it by adding a `set` command in two levels of `CMakeLists.txt` to propagate the modified version of `LLVM_COMMON_DEPENDS` back up through the parent scopes so that `omp_gen` does end up on the version seen by the main `llvm/CMakeLists.txt`. Reviewers: clementval, thakis, chandlerc, jdoerfert Reviewed By: clementval Subscribers: jdenny, mgorny, sstefan1, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D82659
1 parent 767c9c5 commit ed4328c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

llvm/include/llvm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ add_subdirectory(Frontend/OpenMP)
77
if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
88
configure_file(module.modulemap.build module.modulemap COPYONLY)
99
endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
10+
11+
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
set(LLVM_TARGET_DEFINITIONS OMP.td)
22
tablegen(LLVM OMP.h.inc --gen-directive-decls)
33
add_public_tablegen_target(omp_gen)
4+
5+
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)

0 commit comments

Comments
 (0)