Skip to content

Commit 41e6303

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 b6af4a7 commit 41e6303

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
@@ -158,6 +158,10 @@ function(add_swift_compiler_modules_library name)
158158
"-emit-module-path" "${build_dir}/${module}.swiftmodule"
159159
"-parse-as-library" ${sources}
160160
"-wmo" ${swift_compile_options}
161+
# LLVM modules and headers.
162+
"-Xcc" "-I" "-Xcc" "${LLVM_MAIN_INCLUDE_DIR}"
163+
# Generated LLVM headers.
164+
"-Xcc" "-I" "-Xcc" "${LLVM_INCLUDE_DIR}"
161165
# Bridging modules and headers.
162166
"-Xcc" "-I" "-Xcc" "${SWIFT_SOURCE_DIR}/include"
163167
# 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)