Skip to content

Commit 4b9f846

Browse files
committed
unittests: add a hack to use the host compiler
Unfortunately, ASAN breaks with the just built compiler. The runtime and the runtime tests should really use the same compiler. As a workaround, if the host compiler is clang, just use that for the time being. This should fix the build on the ASAN bots.
1 parent e9817b0 commit 4b9f846

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

unittests/runtime/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
22
("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "${SWIFT_PRIMARY_VARIANT_ARCH}"))
33

4-
if(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
4+
if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
5+
# Do nothing
6+
elseif(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
57
if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
68
message(FATAL_ERROR "Building the swift runtime is not supported with ${CMAKE_C_COMPILER_ID}. Use the just-built clang instead.")
7-
else()
8-
message(WARNING "Building the swift runtime using the host compiler, and not the just-built clang.")
99
endif()
1010
else()
11+
message(WARNING "Building the swift runtime using the host compiler, and not the just-built clang.")
12+
1113
# If we use Clang-cl or MSVC, CMake provides default compiler and linker flags that are incompatible
1214
# with the frontend of Clang or Clang++.
1315
if(SWIFT_COMPILER_IS_MSVC_LIKE)

0 commit comments

Comments
 (0)