Skip to content

Commit 5768aeb

Browse files
committed
[cxx-interop][SwiftCompilerSources] Add LLVM headers to the include paths
This allows the Swift compiler to find headers like `llvm/Support/Compiler.h` that are used by Swift headers.
1 parent 038a4f0 commit 5768aeb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ function(add_swift_compiler_modules_library name)
165165
"-emit-module-path" "${build_dir}/${module}.swiftmodule"
166166
"-parse-as-library" ${sources}
167167
"-wmo" ${swift_compile_options}
168+
# LLVM modules and headers.
169+
"-Xcc" "-I" "-Xcc" "${LLVM_MAIN_INCLUDE_DIR}"
170+
# Generated LLVM headers.
171+
"-Xcc" "-I" "-Xcc" "${LLVM_INCLUDE_DIR}"
168172
# Bridging modules and headers.
169173
"-Xcc" "-I" "-Xcc" "${SWIFT_SOURCE_DIR}/include"
170174
# Generated C headers.

SwiftCompilerSources/Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ private extension Target {
2020
"-Xfrontend", "-enable-cxx-interop",
2121
// Bridging modules and headers
2222
"-Xcc", "-I", "-Xcc", "../include",
23+
// LLVM modules and headers
24+
"-Xcc", "-I", "-Xcc", "../../llvm-project/llvm/include",
2325
"-cross-module-optimization"
2426
]),
2527
]

0 commit comments

Comments
 (0)