Skip to content

Commit bd43806

Browse files
authored
Merge pull request #3200 from gottesmm/use_swift_tablegen_instead_of_llvm_tablegen
Use swift tablegen instead of llvm tablegen
2 parents 25ac3a2 + 5d984de commit bd43806

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

cmake/modules/AddSwiftTableGen.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
include(TableGen)
2+
3+
# This needs to be a macro since tablegen (which is a function) needs to set
4+
# variables in its parent scope.
5+
macro(swift_tablegen)
6+
tablegen(SWIFT ${ARGN})
7+
endmacro()
8+
9+
# This needs to be a macro since add_public_tablegen_target (which is a
10+
# function) needs to set variables in its parent scope.
11+
macro(swift_add_public_tablegen_target target)
12+
add_public_tablegen_target(${target})
13+
endmacro()

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,19 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
107107
endif()
108108

109109
if(${is_cross_compiling})
110-
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" "${${product}_NATIVE_LLVM_TOOLS_PATH}"
110+
find_program(SWIFT_TABLEGEN_EXE "llvm-tblgen" "${${product}_NATIVE_LLVM_TOOLS_PATH}"
111111
NO_DEFAULT_PATH)
112-
if ("${LLVM_TABLEGEN_EXE}" STREQUAL "LLVM_TABLEGEN_EXE-NOTFOUND")
112+
if ("${SWIFT_TABLEGEN_EXE}" STREQUAL "SWIFT_TABLEGEN_EXE-NOTFOUND")
113113
message(FATAL_ERROR "Failed to find tablegen in ${${product}_NATIVE_LLVM_TOOLS_PATH}")
114114
endif()
115115
else()
116-
set(LLVM_TABLEGEN_EXE llvm-tblgen)
116+
set(SWIFT_TABLEGEN_EXE llvm-tblgen)
117117
set(${product}_NATIVE_LLVM_TOOLS_PATH "${PATH_TO_LLVM_TOOLS_BINARY_DIR}")
118118
set(${product}_NATIVE_CLANG_TOOLS_PATH "${PATH_TO_LLVM_TOOLS_BINARY_DIR}")
119119
endif()
120120

121121
include(AddLLVM)
122-
include(TableGen)
122+
include(AddSwiftTableGen) # This imports TableGen from LLVM.
123123
include(HandleLLVMOptions)
124124

125125
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")

include/swift/Option/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set(LLVM_TARGET_DEFINITIONS Options.td)
2-
tablegen(LLVM Options.inc -gen-opt-parser-defs)
3-
add_public_tablegen_target(SwiftOptions)
2+
swift_tablegen(Options.inc -gen-opt-parser-defs)
3+
swift_add_public_tablegen_target(SwiftOptions)

tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_TARGET_DEFINITIONS Options.td)
2-
tablegen(LLVM Options.inc -gen-opt-parser-defs)
3-
add_public_tablegen_target(sourcekitdTestOptionsTableGen)
2+
swift_tablegen(Options.inc -gen-opt-parser-defs)
3+
swift_add_public_tablegen_target(sourcekitdTestOptionsTableGen)
44

55
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
66
set(SOURCEKITD_TEST_DEPEND sourcekitdInProc)

0 commit comments

Comments
 (0)