Skip to content

Commit 6a64171

Browse files
committed
Merge branch 'master' of github.com:swiftwasm/swift into maxd/master-merge
# Conflicts: # cmake/modules/AddSwift.cmake # include/swift/Basic/Lazy.h
2 parents 8381680 + d9c3a84 commit 6a64171

File tree

77 files changed

+1962
-1058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1962
-1058
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 66 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,16 @@ function(_add_host_variant_link_flags target)
401401
endif()
402402
endfunction()
403403

404-
# Add a single variant of a new Swift library.
404+
# Add a new Swift host library.
405405
#
406406
# Usage:
407-
# _add_swift_host_library_single(
408-
# target
407+
# add_swift_host_library(name
409408
# [SHARED]
410409
# [STATIC]
411410
# [LLVM_LINK_COMPONENTS comp1 ...]
412411
# source1 [source2 source3 ...])
413412
#
414-
# target
413+
# name
415414
# Name of the library (e.g., swiftParse).
416415
#
417416
# SHARED
@@ -424,229 +423,142 @@ endfunction()
424423
# LLVM components this library depends on.
425424
#
426425
# source1 ...
427-
# Sources to add into this library
428-
function(_add_swift_host_library_single target)
426+
# Sources to add into this library.
427+
function(add_swift_host_library name)
429428
set(options
430429
SHARED
431430
STATIC)
432431
set(single_parameter_options)
433432
set(multiple_parameter_options
434433
LLVM_LINK_COMPONENTS)
435434

436-
cmake_parse_arguments(ASHLS
435+
cmake_parse_arguments(ASHL
437436
"${options}"
438437
"${single_parameter_options}"
439438
"${multiple_parameter_options}"
440439
${ARGN})
441-
set(ASHLS_SOURCES ${ASHLS_UNPARSED_ARGUMENTS})
440+
set(ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS})
442441

443-
translate_flags(ASHLS "${options}")
442+
translate_flags(ASHL "${options}")
444443

445-
if(NOT ASHLS_SHARED AND NOT ASHLS_STATIC)
444+
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
446445
message(FATAL_ERROR "Either SHARED or STATIC must be specified")
447446
endif()
448447

449-
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
450-
set(embed_bitcode_arg)
451-
if(SWIFT_EMBED_BITCODE_SECTION)
452-
if(SWIFT_HOST_VARIANT_SDK MATCHES "(I|TV|WATCH)OS")
453-
list(APPEND ASHLS_C_COMPILE_FLAGS "-fembed-bitcode")
454-
set(embed_bitcode_arg EMBED_BITCODE)
455-
endif()
456-
endif()
457-
458448
if(XCODE)
459-
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
460-
list(GET split_path -1 dir)
461-
file(GLOB_RECURSE ASHLS_HEADERS
449+
get_filename_component(dir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
450+
451+
file(GLOB_RECURSE ASHL_HEADERS
462452
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.h
463453
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.def
464454
${CMAKE_CURRENT_SOURCE_DIR}/*.def)
465-
466-
file(GLOB_RECURSE ASHLS_TDS
455+
file(GLOB_RECURSE ASHL_TDS
467456
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.td)
468457

469-
set_source_files_properties(${ASHLS_HEADERS} ${ASHLS_TDS}
470-
PROPERTIES
458+
set_source_files_properties(${ASHL_HEADERS} ${ASHL_TDS} PROPERTIES
471459
HEADER_FILE_ONLY true)
472-
source_group("TableGen descriptions" FILES ${ASHLS_TDS})
460+
source_group("TableGen descriptions" FILES ${ASHL_TDS})
473461

474-
set(ASHLS_SOURCES ${ASHLS_SOURCES} ${ASHLS_HEADERS} ${ASHLS_TDS})
462+
set(ASHL_SOURCES ${ASHL_SOURCES} ${ASHL_HEADERS} ${ASHL_TDS})
475463
endif()
476464

477-
if(ASHLS_SHARED)
465+
if(ASHL_SHARED)
478466
set(libkind SHARED)
479-
elseif(ASHLS_STATIC)
467+
elseif(ASHL_STATIC)
480468
set(libkind STATIC)
481469
endif()
482470

483-
add_library("${target}" ${libkind} ${ASHLS_SOURCES})
484-
_set_target_prefix_and_suffix("${target}" "${libkind}" "${SWIFT_HOST_VARIANT_SDK}")
485-
add_dependencies(${target} ${LLVM_COMMON_DEPENDS})
486-
487-
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
488-
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH} SWIFTLIB_INCLUDE)
489-
target_include_directories("${target}" SYSTEM PRIVATE ${SWIFTLIB_INCLUDE})
490-
set_target_properties(${target}
491-
PROPERTIES
492-
CXX_STANDARD 14)
493-
endif()
494-
495-
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
496-
set_property(TARGET "${target}" PROPERTY NO_SONAME ON)
497-
endif()
498-
499-
llvm_update_compile_flags(${target})
500-
501-
set_output_directory(${target}
471+
add_library(${name} ${libkind} ${ASHL_SOURCES})
472+
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
473+
llvm_update_compile_flags(${name})
474+
swift_common_llvm_config(${name} ${ASHL_LLVM_LINK_COMPONENTS})
475+
set_output_directory(${name}
502476
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
503477
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
504478

505479
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
506-
set_target_properties("${target}"
480+
set_target_properties(${name}
507481
PROPERTIES
508482
INSTALL_NAME_DIR "@rpath")
509483
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL LINUX)
510-
set_target_properties("${target}"
484+
set_target_properties(${name}
511485
PROPERTIES
512486
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux")
513487
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL CYGWIN)
514-
set_target_properties("${target}"
488+
set_target_properties(${name}
515489
PROPERTIES
516490
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin")
517491
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
518-
set_target_properties("${target}"
492+
set_target_properties(${name}
519493
PROPERTIES
520494
INSTALL_RPATH "$ORIGIN")
521495
endif()
522496

523-
set_target_properties("${target}" PROPERTIES BUILD_WITH_INSTALL_RPATH YES)
524-
set_target_properties("${target}" PROPERTIES FOLDER "Swift libraries")
525-
526-
# Call llvm_config() only for libraries that are part of the compiler.
527-
swift_common_llvm_config("${target}" ${ASHLS_LLVM_LINK_COMPONENTS})
528-
529-
target_compile_options(${target} PRIVATE
530-
${ASHLS_C_COMPILE_FLAGS})
531-
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
532-
if(libkind STREQUAL SHARED)
533-
target_compile_definitions(${target} PRIVATE
534-
_WINDLL)
535-
endif()
536-
endif()
537-
# Double-check that we're not trying to build a dynamic library for WASM.
538-
if(SWIFTLIB_SINGLE_SDK MATCHES WASM)
539-
if(libkind STREQUAL SHARED)
540-
message(FATAL_ERROR "WASM does not support shared libraries.")
541-
endif()
542-
endif()
497+
set_target_properties(${name} PROPERTIES
498+
BUILD_WITH_INSTALL_RPATH YES
499+
FOLDER "Swift libraries")
543500

544-
_add_host_variant_c_compile_flags(${target})
545-
_add_host_variant_link_flags(${target})
501+
_add_host_variant_c_compile_flags(${name})
502+
_add_host_variant_link_flags(${name})
503+
_set_target_prefix_and_suffix(${name} "${libkind}" "${SWIFT_HOST_VARIANT_SDK}")
546504

547505
# Set compilation and link flags.
548506
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
549507
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH}
550508
${SWIFT_HOST_VARIANT_ARCH}_INCLUDE)
551-
target_include_directories(${target} SYSTEM PRIVATE
509+
target_include_directories(${name} SYSTEM PRIVATE
552510
${${SWIFT_HOST_VARIANT_ARCH}_INCLUDE})
553511

512+
if(libkind STREQUAL SHARED)
513+
target_compile_definitions(${name} PRIVATE
514+
_WINDLL)
515+
endif()
516+
554517
if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
555-
swift_windows_get_sdk_vfs_overlay(ASHLS_VFS_OVERLAY)
556-
target_compile_options(${target} PRIVATE
557-
"SHELL:-Xclang -ivfsoverlay -Xclang ${ASHLS_VFS_OVERLAY}")
518+
swift_windows_get_sdk_vfs_overlay(ASHL_VFS_OVERLAY)
519+
target_compile_options(${name} PRIVATE
520+
"SHELL:-Xclang -ivfsoverlay -Xclang ${ASHL_VFS_OVERLAY}")
558521

559522
# MSVC doesn't support -Xclang. We don't need to manually specify
560523
# the dependent libraries as `cl` does so.
561-
target_compile_options(${target} PRIVATE
524+
target_compile_options(${name} PRIVATE
562525
"SHELL:-Xclang --dependent-lib=oldnames"
563526
# TODO(compnerd) handle /MT, /MTd
564527
"SHELL:-Xclang --dependent-lib=msvcrt$<$<CONFIG:Debug>:d>")
565528
endif()
529+
530+
set_target_properties(${name} PROPERTIES
531+
CXX_STANDARD 14
532+
NO_SONAME YES)
566533
endif()
567534

568535
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
569-
target_link_options(${target} PRIVATE
570-
"LINKER:-compatibility_version,1")
571-
if(SWIFT_COMPILER_VERSION)
572-
target_link_options(${target} PRIVATE
573-
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
574-
endif()
575536
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
576537
if(SWIFT_EMBED_BITCODE_SECTION)
577-
if(${SWIFT_HOST_VARIANT_SDK} MATCHES "(I|TV|WATCH)OS")
578-
target_link_options(${target} PRIVATE
579-
"LINKER:-bitcode_bundle"
580-
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
581-
582-
# Please note that using a generator expression to fit
583-
# this in a single target_link_options does not work
584-
# (at least in CMake 3.15 and 3.16),
585-
# since that seems not to allow the LINKER: prefix to be
586-
# evaluated (i.e. it will be added as-is to the linker parameters)
587-
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
588-
target_link_options(${target} PRIVATE
589-
"LINKER:-bitcode_hide_symbols")
590-
endif()
538+
target_compile_options(${name} PRIVATE
539+
-fembed-bitcode)
540+
target_link_options(${name} PRIVATE
541+
"LINKER:-bitcode_bundle"
542+
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
543+
544+
# Please note that using a generator expression to fit this in a single
545+
# target_link_options does not work (at least in CMake 3.15 and 3.16),
546+
# since that seems not to allow the LINKER: prefix to be evaluated (i.e.
547+
# it will be added as-is to the linker parameters)
548+
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
549+
target_link_options(${name} PRIVATE
550+
"LINKER:-bitcode_hide_symbols")
591551
endif()
592552
endif()
593-
endif()
594553

595-
# Do not add code here.
596-
endfunction()
597-
598-
# Add a new Swift host library.
599-
#
600-
# Usage:
601-
# add_swift_host_library(name
602-
# [SHARED]
603-
# [STATIC]
604-
# [LLVM_LINK_COMPONENTS comp1 ...]
605-
# source1 [source2 source3 ...])
606-
#
607-
# name
608-
# Name of the library (e.g., swiftParse).
609-
#
610-
# SHARED
611-
# Build a shared library.
612-
#
613-
# STATIC
614-
# Build a static library.
615-
#
616-
# LLVM_LINK_COMPONENTS
617-
# LLVM components this library depends on.
618-
#
619-
# source1 ...
620-
# Sources to add into this library.
621-
function(add_swift_host_library name)
622-
set(options
623-
SHARED
624-
STATIC)
625-
set(single_parameter_options)
626-
set(multiple_parameter_options
627-
LLVM_LINK_COMPONENTS)
628-
629-
cmake_parse_arguments(ASHL
630-
"${options}"
631-
"${single_parameter_options}"
632-
"${multiple_parameter_options}"
633-
${ARGN})
634-
set(ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS})
635-
636-
translate_flags(ASHL "${options}")
637-
638-
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
639-
message(FATAL_ERROR "Either SHARED or STATIC must be specified")
554+
target_link_options(${name} PRIVATE
555+
"LINKER:-compatibility_version,1")
556+
if(SWIFT_COMPILER_VERSION)
557+
target_link_options(${name} PRIVATE
558+
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
559+
endif()
640560
endif()
641561

642-
_add_swift_host_library_single(
643-
${name}
644-
${ASHL_SHARED_keyword}
645-
${ASHL_STATIC_keyword}
646-
${ASHL_SOURCES}
647-
LLVM_LINK_COMPONENTS ${ASHL_LLVM_LINK_COMPONENTS}
648-
)
649-
650562
add_dependencies(dev ${name})
651563
if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
652564
swift_install_in_component(TARGETS ${name}

include/swift/AST/ASTContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ namespace swift {
121121
class UnifiedStatsReporter;
122122
class IndexSubset;
123123
struct SILAutoDiffDerivativeFunctionKey;
124-
struct SubASTContextDelegate;
124+
struct InterfaceSubContextDelegate;
125125

126126
enum class KnownProtocolKind : uint8_t;
127127

@@ -721,7 +721,7 @@ class ASTContext final {
721721
StringRef moduleName,
722722
bool isUnderlyingClangModule,
723723
ModuleDependenciesCache &cache,
724-
SubASTContextDelegate &delegate);
724+
InterfaceSubContextDelegate &delegate);
725725

726726
/// Load extensions to the given nominal type from the external
727727
/// module loaders.

0 commit comments

Comments
 (0)