Skip to content

Commit c64b8b9

Browse files
Merge pull request #3806 from swiftwasm/katei/merge-main-2021-10-29
Merge main 2021-10-29
2 parents 211f95a + 2424048 commit c64b8b9

File tree

186 files changed

+4908
-1171
lines changed

Some content is hidden

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

186 files changed

+4908
-1171
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ function(add_libswift name)
732732
733733
set(libswift_compile_options
734734
"-Xfrontend" "-validate-tbd-against-ir=none"
735-
"-Xfrontend" "-enable-cxx-interop")
735+
"-Xfrontend" "-enable-cxx-interop"
736+
"-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable")
736737
737738
if(CMAKE_BUILD_TYPE STREQUAL Debug)
738739
list(APPEND libswift_compile_options "-g")

cmake/modules/SwiftWindowsSupport.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ endfunction()
8181
# NOTE(compnerd) we use a macro here as this modifies global variables
8282
macro(swift_swap_compiler_if_needed target)
8383
if(NOT CMAKE_C_COMPILER_ID MATCHES Clang)
84-
if(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
84+
if(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
8585
if(SWIFT_BUILT_STANDALONE)
8686
get_target_property(CLANG_LOCATION clang LOCATION)
8787
get_filename_component(CLANG_LOCATION ${CLANG_LOCATION} DIRECTORY)

docs/ReferenceGuides/UnderscoredAttributes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,3 +620,8 @@ within Swift 5 code that has adopted concurrency, but non-`@MainActor`
620620

621621
See the forum post on [Concurrency in Swift 5 and 6](https://forums.swift.org/t/concurrency-in-swift-5-and-6/49337)
622622
for more details.
623+
624+
## `@_noImplicitCopy`
625+
626+
Marks a var decl as a variable that must be copied explicitly using the builtin
627+
function Builtin.copy.

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,12 @@ class SDKNodeDecl: public SDKNode {
360360
Optional<uint8_t> FixedBinaryOrder;
361361
PlatformIntroVersion introVersions;
362362
StringRef ObjCName;
363-
mutable Optional<StringRef> demangledName;
363+
364364
protected:
365365
SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind);
366366
virtual ~SDKNodeDecl() = default;
367367
public:
368368
StringRef getUsr() const { return Usr; }
369-
StringRef getDemangledName() const;
370369
StringRef getLocation() const { return Location; }
371370
StringRef getModuleName() const {return ModuleName;}
372371
StringRef getHeaderName() const;

include/swift/AST/Attr.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,13 @@ DECL_ATTR(_nonSendable, NonSendable,
672672
APIStableToAdd | APIBreakingToRemove,
673673
121)
674674

675+
SIMPLE_DECL_ATTR(_noImplicitCopy, NoImplicitCopy,
676+
UserInaccessible |
677+
ABIStableToAdd | ABIBreakingToRemove |
678+
APIStableToAdd | APIBreakingToRemove |
679+
OnVar,
680+
122)
681+
675682
// If you're adding a new underscored attribute here, please document it in
676683
// docs/ReferenceGuides/UnderscoredAttributes.md.
677684

include/swift/AST/Builtins.def

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,6 @@ BUILTIN_SIL_OPERATION(WithUnsafeThrowingContinuation, "withUnsafeThrowingContinu
515515
/// Force the current task to be rescheduled on the specified actor.
516516
BUILTIN_SIL_OPERATION(HopToActor, "hopToActor", None)
517517

518-
/// Generate a move_value instruction to convert a T to a @_moveOnly T.
519-
BUILTIN_SIL_OPERATION(Move, "move", Special)
520-
521518
#undef BUILTIN_SIL_OPERATION
522519

523520
// BUILTIN_RUNTIME_CALL - A call into a runtime function.
@@ -603,6 +600,29 @@ BUILTIN_MISC_OPERATION(AllocRaw, "allocRaw", "", Special)
603600
/// was allocated.
604601
BUILTIN_MISC_OPERATION(DeallocRaw, "deallocRaw", "", Special)
605602

603+
/// StackAlloc has type (Int, Int, Int) -> Builtin.RawPointer
604+
///
605+
/// Parameters: capacity, stride, alignment
606+
///
607+
/// The resulting pointer comes from the stack (as in the non-standard C
608+
/// extension `alloca()`.) It is at least as aligned as specified and is valid
609+
/// until the end of the calling scope.
610+
///
611+
/// The count and stride are multiplied together to get the byte count to use
612+
/// for the allocation.
613+
///
614+
/// The passed alignment must be a positive power of two. If the alignment value
615+
/// is not known at compile time, MaximumAlignment is assumed.
616+
BUILTIN_MISC_OPERATION(StackAlloc, "stackAlloc", "", Special)
617+
618+
/// StackDealloc has type (Builtin.RawPointer) -> ()
619+
///
620+
/// Parameters: address.
621+
///
622+
/// The range starting at `address`, previously allocated with
623+
/// Builtin.stackAlloc(), is deallocated from the stack.
624+
BUILTIN_MISC_OPERATION(StackDealloc, "stackDealloc", "", Special)
625+
606626
/// Fence has type () -> ().
607627
BUILTIN_MISC_OPERATION(Fence, "fence", "", None)
608628

@@ -757,6 +777,19 @@ BUILTIN_MISC_OPERATION(CreateTaskGroup,
757777
BUILTIN_MISC_OPERATION(DestroyTaskGroup,
758778
"destroyTaskGroup", "", Special)
759779

780+
781+
/// A builtin that can only be called from a transparent generic function. Takes
782+
/// two operands, the first operand the result address, the second operand the
783+
/// input address. Transforms into load [take] + move_value + store [init] when
784+
/// transparently inlined into a caller that has the generic of the callee
785+
/// specialized into a loadable type. If the transparent inlining does not
786+
/// specialize the type (due to being inlined into a non-generic context, the
787+
/// SILVerifier will abort).
788+
///
789+
/// Illegal to call except for in Swift._move in the stdlib. This is enforced by
790+
/// the SILVerifier.
791+
BUILTIN_MISC_OPERATION(Move, "move", "", Special)
792+
760793
// BUILTIN_MISC_OPERATION_WITH_SILGEN - Miscellaneous operations that are
761794
// specially emitted during SIL generation.
762795
//

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ ERROR(error_mode_cannot_emit_module_semantic_info,none,
136136
ERROR(cannot_emit_ir_skipping_function_bodies,none,
137137
"the -experimental-skip-*-function-bodies* flags do not support "
138138
"emitting IR", ())
139+
ERROR(cannot_emit_ir_checking_api_availability_only,none,
140+
"the flag -check-api-availability-only does not support "
141+
"emitting IR", ())
139142

140143
WARNING(emit_reference_dependencies_without_primary_file,none,
141144
"ignoring -emit-reference-dependencies (requires -primary-file)", ())

include/swift/AST/DiagnosticsIRGen.def

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,14 @@ ERROR(alignment_more_than_maximum,none,
5050
"@_alignment cannot increase alignment above maximum alignment of %0",
5151
(unsigned))
5252

53+
ERROR(temporary_allocation_size_negative,none,
54+
"allocation capacity must be greater than or equal to zero", ())
55+
ERROR(temporary_allocation_size_overflow,none,
56+
"allocation byte count too large", ())
57+
ERROR(temporary_allocation_alignment_not_positive,none,
58+
"alignment value must be greater than zero", ())
59+
ERROR(temporary_allocation_alignment_not_power_of_2,none,
60+
"alignment value must be a power of two", ())
61+
5362
#define UNDEFINE_DIAGNOSTIC_MACROS
5463
#include "DefineDiagnosticMacros.h"

include/swift/AST/DiagnosticsSIL.def

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,5 +686,20 @@ NOTE(capturepromotion_concurrentcapture_capturinguse_here, none,
686686
NOTE(capturepromotion_variable_defined_here,none,
687687
"variable defined here", ())
688688

689+
// move operator used on generic or evalue
690+
ERROR(move_operator_used_on_generic_or_existential_value, none,
691+
"move() used on a generic or existential value", ())
692+
693+
// noimplicitcopy on generic or existential binding
694+
ERROR(noimplicitcopy_used_on_generic_or_existential, none,
695+
"@_noImplicitCopy can not be used on a generic or existential typed "
696+
"binding or a nominal type containing such typed things", ())
697+
698+
// move only checker diagnostics
699+
ERROR(sil_moveonlychecker_value_consumed_more_than_once, none,
700+
"'%0' consumed more than once", (StringRef))
701+
NOTE(sil_moveonlychecker_consuming_use_here, none,
702+
"consuming use", ())
703+
689704
#define UNDEFINE_DIAGNOSTIC_MACROS
690705
#include "DefineDiagnosticMacros.h"

include/swift/AST/DiagnosticsSema.def

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,6 +2263,11 @@ NOTE(associated_type_witness_conform_impossible,none,
22632263
"candidate can not infer %0 = %1 because %1 "
22642264
"is not a nominal type and so can't conform to %2",
22652265
(Identifier, Type, Type))
2266+
NOTE(suggest_opaque_type_witness,none,
2267+
"cannot infer %0 = %1 because %1 as a type cannot "
2268+
"conform to protocols; did you mean to use an opaque "
2269+
"result type?",
2270+
(Identifier, Type, Type))
22662271
NOTE(associated_type_witness_inherit_impossible,none,
22672272
"candidate can not infer %0 = %1 because %1 "
22682273
"is not a class type and so can't inherit from %2",
@@ -6029,5 +6034,16 @@ ERROR(wrap_invalid_attr_added_by_access_note, none,
60296034

60306035
#undef WHICH_ACCESS_NOTE
60316036

6037+
// Move Only diagnostics
6038+
6039+
ERROR(experimental_moveonly_feature_can_only_be_used_when_enabled,
6040+
none, "Can not use feature when experimental move only is disabled! Pass"
6041+
" the frontend flag -enable-experimental-move-only to swift to enable "
6042+
"the usage of this language feature", ())
6043+
ERROR(noimplicitcopy_attr_valid_only_on_local_let,
6044+
none, "'@_noImplicitCopy' attribute can only be applied to local lets", ())
6045+
ERROR(noimplicitcopy_attr_invalid_in_generic_context,
6046+
none, "'@_noImplicitCopy' attribute cannot be applied to entities in generic contexts", ())
6047+
60326048
#define UNDEFINE_DIAGNOSTIC_MACROS
60336049
#include "DefineDiagnosticMacros.h"

0 commit comments

Comments
 (0)