Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
26c1617
TBDGen: also using target variant to decide whether @_originallyDefin…
nkcsgexi Jan 27, 2020
c7c9510
[ConstraintSystem] Don't re-attempt to bind type variable if it could…
xedin Jan 25, 2020
dea79e0
[ConstraintSystem] Detect that function type has failures before appl…
xedin Jan 27, 2020
e50756c
[CSDiag] Obsolete function re-typecheck and diagnostics from `visitAp…
xedin Jan 28, 2020
c198c1a
[Constant Evaluator] Add support for BinaryInteger.description which
ravikandhadai Jan 28, 2020
a1c9719
build: repair the Windows build
compnerd Jan 27, 2020
3e42a0f
[android] Escape include paths in Android.
drodriguez Jan 28, 2020
c662a91
Merge pull request #29490 from xedin/remove-more-code-from-visitapply…
xedin Jan 28, 2020
38aded7
[Diagnostics] Add a special case diagnostic for call to init on `Void…
xedin Jan 28, 2020
8777a87
Merge pull request #29502 from drodriguez/android-escape-include-path…
drodriguez Jan 28, 2020
02b6161
Merge pull request #29483 from compnerd/duplication-is-good-for-you
compnerd Jan 28, 2020
18babf7
SILGen: Lower the type of the return value merge phi in the context o…
aschwaighofer Jan 27, 2020
6f026fb
Merge pull request #29504 from xedin/special-void-init-handling
xedin Jan 28, 2020
049e384
build: move `compute_library_subdir` to where it is used
compnerd Jan 28, 2020
5428060
[build][gardening] adjust framework paths (#29507)
edymtt Jan 28, 2020
88d6559
[GSB] Map invalid subject types in requirement constraints to ErrorType
CodaFi Jan 27, 2020
f83fead
Merge pull request #29485 from nkcsgexi/zippered-linker-directive
nkcsgexi Jan 28, 2020
566d574
Merge pull request #29501 from ravikandhadai/constexpr-binary-integer…
ravikandhadai Jan 28, 2020
1fff12f
Merge pull request #29511 from compnerd/cohabitation
compnerd Jan 28, 2020
a5ff907
Merge pull request #29508 from aschwaighofer/silgen_fix_return_arg_ty…
aschwaighofer Jan 28, 2020
c81cecf
Merge pull request #29491 from CodaFi/constraint-kinds
CodaFi Jan 28, 2020
255b2cf
[NFC] Improve Nested Types Table Test
CodaFi Jan 28, 2020
4a123f1
Fix the build-script --skip-build option.
atrick Jan 28, 2020
608b1b4
[ConstraintSystem] Allow solving same-type requirements for associate…
hborla Jan 28, 2020
bf41881
Move swift runtime failure from linkage name to function name
medismailben Jan 22, 2020
aa8d69a
Merge pull request #29517 from CodaFi/nest-egg
swift-ci Jan 28, 2020
682bb31
[Constant Evaluator] Add support for displaying assertion/precondition
ravikandhadai Jan 28, 2020
d160503
Merge pull request #29520 from hborla/same-type-requirement-corner-case
hborla Jan 29, 2020
14fd6c8
Merge pull request #29506 from medismailben/master
medismailben Jan 29, 2020
39d28fc
Merge pull request #29500 from atrick/fix-skip-build
Rostepher Jan 29, 2020
4d65c34
Merge pull request #29521 from ravikandhadai/constexpr-precondition-s…
ravikandhadai Jan 29, 2020
7392c8d
[WebAssembly] Add no-op MutexWASI.h implementation (#29459)
MaxDesiatov Jan 29, 2020
44a6475
[WebAssembly] enable shims and stubs for WASI (#29505)
MaxDesiatov Jan 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 46 additions & 35 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ function(add_dependencies_multiple_targets)
endif()
endfunction()

# Compute the library subdirectory to use for the given sdk and
# architecture, placing the result in 'result_var_name'.
function(compute_library_subdir result_var_name sdk arch)
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS OR sdk STREQUAL "MACCATALYST")
set("${result_var_name}" "${SWIFT_SDK_${sdk}_LIB_SUBDIR}" PARENT_SCOPE)
else()
set("${result_var_name}" "${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}" PARENT_SCOPE)
endif()
endfunction()

function(_compute_lto_flag option out_var)
string(TOLOWER "${option}" lowercase_option)
if (lowercase_option STREQUAL "full")
Expand Down Expand Up @@ -163,9 +153,12 @@ function(_add_variant_c_compile_link_flags)
endif()

if(IS_DARWIN)
# We collate -F with the framework path to avoid unwanted deduplication
# of options by target_compile_options -- this way no undesired
# side effects are introduced should a new search path be added.
list(APPEND result
"-arch" "${CFLAGS_ARCH}"
"-F" "${SWIFT_SDK_${CFLAGS_SDK}_PATH}/../../../Developer/Library/Frameworks")
"-F${SWIFT_SDK_${CFLAGS_SDK}_PATH}/../../../Developer/Library/Frameworks")

set(add_explicit_version TRUE)

Expand Down Expand Up @@ -264,18 +257,6 @@ function(_add_variant_c_compile_flags)
endif()

if("${CFLAGS_SDK}" STREQUAL "WINDOWS")
# MSVC doesn't support -Xclang. We don't need to manually specify
# the dependent libraries as `cl` does so.
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
list(APPEND result -Xclang;--dependent-lib=oldnames)
# TODO(compnerd) handle /MT, /MTd
if("${CFLAGS_BUILD_TYPE}" STREQUAL "Debug")
list(APPEND result -Xclang;--dependent-lib=msvcrtd)
else()
list(APPEND result -Xclang;--dependent-lib=msvcrt)
endif()
endif()

# MSVC/clang-cl don't support -fno-pic or -fms-compatibility-version.
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
list(APPEND result -fno-pic)
Expand Down Expand Up @@ -363,14 +344,9 @@ function(_add_variant_c_compile_flags)
swift_android_libcxx_include_paths(CFLAGS_CXX_INCLUDES)
swift_android_include_for_arch("${CFLAGS_ARCH}" "${CFLAGS_ARCH}_INCLUDE")
foreach(path IN LISTS CFLAGS_CXX_INCLUDES ${CFLAGS_ARCH}_INCLUDE)
list(APPEND result -isystem;${path})
list(APPEND result "SHELL:${CMAKE_INCLUDE_SYSTEM_FLAG_C}${path}")
endforeach()
list(APPEND result "-D__ANDROID_API__=${SWIFT_ANDROID_API_LEVEL}")
elseif(CFLAGS_SDK STREQUAL WINDOWS)
swift_windows_include_for_arch(${CFLAGS_ARCH} ${CFLAGS_ARCH}_INCLUDE)
foreach(path ${${CFLAGS_ARCH}_INCLUDE})
list(APPEND result "\"${CMAKE_INCLUDE_FLAG_C}${path}\"")
endforeach()
endif()

set("${CFLAGS_RESULT_VAR_NAME}" "${result}" PARENT_SCOPE)
Expand Down Expand Up @@ -422,8 +398,11 @@ function(_add_variant_swift_compile_flags
endif()

if(IS_DARWIN)
# We collate -F with the framework path to avoid unwanted deduplication
# of options by target_compile_options -- this way no undesired
# side effects are introduced should a new search path be added.
list(APPEND result
"-F" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/../../../Developer/Library/Frameworks")
"-F${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/../../../Developer/Library/Frameworks")
endif()

is_build_type_optimized("${build_type}" optimized)
Expand Down Expand Up @@ -910,11 +889,9 @@ function(_add_swift_library_single target name)

if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
swift_windows_generate_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS)
foreach(flag ${SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS})
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;${flag})
list(APPEND SWIFTLIB_SINGLE_C_COMPILE_FLAGS ${flag})
endforeach()
swift_windows_get_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY)
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS
-Xcc;-Xclang;-Xcc;-ivfsoverlay;-Xcc;-Xclang;-Xcc;${SWIFTLIB_SINGLE_VFS_OVERLAY})
endif()
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
foreach(directory ${SWIFTLIB_INCLUDE})
Expand Down Expand Up @@ -1390,6 +1367,25 @@ function(_add_swift_library_single target name)
endif()

# Set compilation and link flags.
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE}
${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${target} SYSTEM PRIVATE
${${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE})

if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
swift_windows_get_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY)
target_compile_options(${target} PRIVATE
"SHELL:-Xclang -ivfsoverlay -Xclang ${SWIFTLIB_SINGLE_VFS_OVERLAY}")

# MSVC doesn't support -Xclang. We don't need to manually specify
# the dependent libraries as `cl` does so.
target_compile_options(${target} PRIVATE
"SHELL:-Xclang --dependent-lib=oldnames"
# TODO(compnerd) handle /MT, /MTd
"SHELL:-Xclang --dependent-lib=msvcrt$<$<CONFIG:Debug>:d>")
endif()
endif()
target_include_directories(${target} SYSTEM PRIVATE
${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_UC_INCLUDE}
${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_I18N_INCLUDE})
Expand Down Expand Up @@ -2575,6 +2571,21 @@ function(_add_swift_executable_single name)
${SWIFTEXE_SINGLE_DEPENDS})
llvm_update_compile_flags("${name}")

if(SWIFTEXE_SINGLE_SDK STREQUAL WINDOWS)
swift_windows_include_for_arch(${SWIFTEXE_SINGLE_ARCHITECTURE}
${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${name} SYSTEM PRIVATE
${${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE})

if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
# MSVC doesn't support -Xclang. We don't need to manually specify
# the dependent libraries as `cl` does so.
target_compile_options(${name} PRIVATE
"SHELL:-Xclang --dependent-lib=oldnames"
# TODO(compnerd) handle /MT, /MTd
"SHELL:-Xclang --dependent-lib=msvcrt$<$<CONFIG:Debug>:d>")
endif()
endif()
target_compile_options(${name} PRIVATE
${c_compile_flags})
target_link_directories(${name} PRIVATE
Expand Down
10 changes: 10 additions & 0 deletions cmake/modules/SwiftSource.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
include(macCatalystUtils)
include(SwiftUtils)

# Compute the library subdirectory to use for the given sdk and
# architecture, placing the result in 'result_var_name'.
function(compute_library_subdir result_var_name sdk arch)
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS OR sdk STREQUAL "MACCATALYST")
set("${result_var_name}" "${SWIFT_SDK_${sdk}_LIB_SUBDIR}" PARENT_SCOPE)
else()
set("${result_var_name}" "${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}" PARENT_SCOPE)
endif()
endfunction()

# Process the sources within the given variable, pulling out any Swift
# sources to be compiled with 'swift' directly. This updates
# ${sourcesvar} in place with the resulting list and ${externalvar} with the
Expand Down
8 changes: 3 additions & 5 deletions cmake/modules/SwiftWindowsSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function(swift_windows_lib_for_arch arch var)
set(${var} ${paths} PARENT_SCOPE)
endfunction()

function(swift_windows_generate_sdk_vfs_overlay flags)
function(swift_windows_get_sdk_vfs_overlay overlay)
get_filename_component(VCToolsInstallDir ${VCToolsInstallDir} ABSOLUTE)
get_filename_component(UniversalCRTSdkDir ${UniversalCRTSdkDir} ABSOLUTE)
set(UCRTVersion ${UCRTVersion})
Expand All @@ -58,10 +58,8 @@ function(swift_windows_generate_sdk_vfs_overlay flags)
configure_file("${SWIFT_SOURCE_DIR}/utils/WindowsSDKVFSOverlay.yaml.in"
"${CMAKE_CURRENT_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
@ONLY)

set(${flags}
-Xclang;-ivfsoverlay;-Xclang;"${CMAKE_CURRENT_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
PARENT_SCOPE)
set(${overlay} ${CMAKE_CURRENT_BINARY_DIR}/windows-sdk-vfs-overlay.yaml
PARENT_SCOPE)
endfunction()

function(swift_verify_windows_VCVAR var)
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/SemanticAttrs.def
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ SEMANTICS_ATTR(STRING_PLUS_EQUALS, "string.plusequals")
SEMANTICS_ATTR(FIND_STRING_SWITCH_CASE, "findStringSwitchCase")
SEMANTICS_ATTR(FIND_STRING_SWITCH_CASE_WITH_CACHE, "findStringSwitchCaseWithCache")

SEMANTICS_ATTR(BINARY_INTEGER_DESCRIPTION, "binaryInteger.description")

SEMANTICS_ATTR(SWIFT_CONCURRENT_ASYNC, "swift.concurrent.async")
SEMANTICS_ATTR(SWIFT_CONCURRENT_SAFE, "swift.concurrent.safe")
SEMANTICS_ATTR(SWIFT_CONCURRENT, "swift.concurrent")
Expand Down
2 changes: 2 additions & 0 deletions include/swift/Runtime/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "swift/Runtime/MutexPThread.h"
#elif defined(_WIN32)
#include "swift/Runtime/MutexWin32.h"
#elif defined(__wasi__)
#include "swift/Runtime/MutexWASI.h"
#else
#error "Implement equivalent of MutexPThread.h/cpp for your platform."
#endif
Expand Down
69 changes: 69 additions & 0 deletions include/swift/Runtime/MutexWASI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//===--- MutexWASI.h - -----------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// No-op implementation of locks for the WebAssembly System Interface. The
// implementation does not need to perform locking, because as of January 2020
// WebAssembly does not support threads.
// See the current status at https://github.com/WebAssembly/proposals and
// https://github.com/webassembly/threads
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_RUNTIME_MUTEX_WASI_H
#define SWIFT_RUNTIME_MUTEX_WASI_H

namespace swift {

typedef void* ConditionHandle;
typedef void* MutexHandle;
typedef void* ReadWriteLockHandle;

#define SWIFT_CONDITION_SUPPORTS_CONSTEXPR 1
#define SWIFT_MUTEX_SUPPORTS_CONSTEXPR 1
#define SWIFT_READWRITELOCK_SUPPORTS_CONSTEXPR 1

struct ConditionPlatformHelper {
static constexpr ConditionHandle staticInit() {
return nullptr;
};
static void init(ConditionHandle &condition) {}
static void destroy(ConditionHandle &condition) {}
static void notifyOne(ConditionHandle &condition) {}
static void notifyAll(ConditionHandle &condition) {}
static void wait(ConditionHandle &condition, MutexHandle &mutex);
};

struct MutexPlatformHelper {
static constexpr MutexHandle staticInit() { return nullptr; }
static void init(MutexHandle &mutex, bool checked = false) {}
static void destroy(MutexHandle &mutex) {}
static void lock(MutexHandle &mutex) {}
static void unlock(MutexHandle &mutex) {}
static bool try_lock(MutexHandle &mutex) { return true; }
static void unsafeLock(MutexHandle &mutex) {}
static void unsafeUnlock(MutexHandle &mutex) {}
};

struct ReadWriteLockPlatformHelper {
static constexpr ReadWriteLockHandle staticInit() { return nullptr; }
static void init(ReadWriteLockHandle &rwlock) {}
static void destroy(ReadWriteLockHandle &rwlock) {}
static void readLock(ReadWriteLockHandle &rwlock) {}
static bool try_readLock(ReadWriteLockHandle &rwlock) { return true; }
static void readUnlock(ReadWriteLockHandle &rwlock) {}
static void writeLock(ReadWriteLockHandle &rwlock) {}
static bool try_writeLock(ReadWriteLockHandle &rwlock) { return true; }
static void writeUnlock(ReadWriteLockHandle &rwlock) {}
};
}

#endif
11 changes: 10 additions & 1 deletion lib/AST/Attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,19 @@ OriginallyDefinedInAttr::isActivePlatform(const ASTContext &ctx) const {
Result.Platform = Platform;
Result.Version = MovedVersion;
Result.ModuleName = OriginalModuleName;
if (isPlatformActive(Platform, ctx.LangOpts)) {
if (isPlatformActive(Platform, ctx.LangOpts, /*TargetVariant*/false)) {
Result.IsSimulator = ctx.LangOpts.Target.isSimulatorEnvironment();
return Result;
}

// Also check if the platform is active by using target variant. This ensures
// we emit linker directives for multiple platforms when building zippered
// libraries.
if (ctx.LangOpts.TargetVariant.hasValue() &&
isPlatformActive(Platform, ctx.LangOpts, /*TargetVariant*/true)) {
Result.IsSimulator = ctx.LangOpts.TargetVariant->isSimulatorEnvironment();
return Result;
}
return None;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/AST/GenericSignatureBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4361,6 +4361,8 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(

if (subjectType->is<DependentMemberType>()) {
subjectType = resolveDependentMemberTypes(*this, subjectType);
} else {
subjectType = ErrorType::get(subjectType);
}

auto invalidConstraint = Constraint<Type>(
Expand Down
4 changes: 2 additions & 2 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ void IRGenDebugInfoImpl::setCurrentLoc(IRBuilder &Builder,
auto DL = llvm::DebugLoc::get(L.Line, L.Column, Scope, InlinedAt);
Builder.SetCurrentDebugLocation(DL);
}

void IRGenDebugInfoImpl::addFailureMessageToCurrentLoc(IRBuilder &Builder,
StringRef failureMsg) {
auto TrapLoc = Builder.getCurrentDebugLocation();
Expand All @@ -1864,7 +1864,7 @@ void IRGenDebugInfoImpl::addFailureMessageToCurrentLoc(IRBuilder &Builder,
FuncName += failureMsg;

llvm::DISubprogram *TrapSP = DBuilder.createFunction(
MainModule, StringRef(), FuncName, TrapLoc->getFile(), 0, DIFnTy, 0,
MainModule, FuncName, StringRef(), TrapLoc->getFile(), 0, DIFnTy, 0,
llvm::DINode::FlagArtificial, llvm::DISubprogram::SPFlagDefinition,
nullptr, nullptr, nullptr);

Expand Down
4 changes: 2 additions & 2 deletions lib/SILGen/SILGenEpilog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void SILGenFunction::prepareEpilog(Type resultType, bool isThrowing,
// emits unreachable if there is no source level return.
NeedsReturn = (fnConv.funcTy->getNumResults() != 0);
for (auto directResult : fnConv.getDirectSILResults()) {
SILType resultType =
F.mapTypeIntoContext(fnConv.getSILType(directResult));
SILType resultType = F.getLoweredType(
F.mapTypeIntoContext(fnConv.getSILType(directResult)));
epilogBB->createPhiArgument(resultType, ValueOwnershipKind::Owned);
}
}
Expand Down
Loading