Skip to content

Merge main 2021-10-29 #3806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 134 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
2b875c5
[CSStep] Conjunction: Reset current/best score only on failure
xedin Oct 21, 2021
c25952f
[CSStep] Conjunction: Drop element scores in ambiguity cases
xedin Oct 21, 2021
8128450
[CursorInfo] Always add module name to response
bnbarham Oct 21, 2021
cfcc852
[ConstraintSystem] Convert `DefaultConstraints` to a set vector to av…
xedin Oct 19, 2021
568c27f
[ConstraintSystem] Convert `Opened{Existential}Types` to a map vector…
xedin Oct 19, 2021
e95e43d
[ConstraintSystem] Convert `ImplicitValueConversions` to a map vector…
xedin Oct 20, 2021
19c253b
[ConstraintSystem] Convert `argumentMatchingChoices` to a map vector …
xedin Oct 20, 2021
880374e
[ConstraintSystem] Convert `DisjunctionChoices` to a map vector & ass…
xedin Oct 20, 2021
d74e8c9
[ConstraintSystem] Convert `ConversionRestrictions` to a map vector t…
xedin Oct 20, 2021
f765390
[ConstraintSystem] Convert `Fixes` to a set vector to avoid duplicates
xedin Oct 22, 2021
960cbcb
[SILGenCleanup] Do not remove trivial lexical borrow scopes.
gottesmm Oct 22, 2021
f8abf50
[cxx-interop] Bump data length to use uint32_t.
zoecarver Oct 22, 2021
3bb1766
[SILOptimizer] Keep lexical lifetime markers.
nate-chandler Oct 22, 2021
7359f2e
SwiftScan: avoid swapping compilers
compnerd Oct 24, 2021
1cf9622
GenericEnvironment: Replace 'substDependentTypesWithErrorTypes' with …
AnthonyLatsis Oct 25, 2021
e339feb
[Runtime] Add format string attributes.
al45tair Oct 25, 2021
bf59b68
Merge pull request #39897 from compnerd/_InternalScan-cl
compnerd Oct 25, 2021
f1bf7ba
[SE-0322] Temporary uninitialized buffers
grynspan Oct 20, 2021
920bcc2
Merge pull request #39900 from al45tair/problem/84571859
al45tair Oct 25, 2021
b5b702e
[Stdlib] Enable -Wformat-nonliteral and make it an error.
al45tair Oct 25, 2021
e779790
Merge pull request #39861 from xedin/conjunction-reset-score-only-on-…
xedin Oct 25, 2021
983fe46
Merge pull request #39859 from xedin/dedupe-constraint-system-storage
xedin Oct 25, 2021
a29f521
test: update stability-stdlib-abi-with{out}-asserts.test
artemcm Oct 25, 2021
8b34fca
Merge pull request #39904 from artemcm/FixABIStabilitytest
artemcm Oct 25, 2021
ea8209a
Revert "test: update stability-stdlib-abi-with{out}-asserts.test"
artemcm Oct 25, 2021
d2b062d
Revert "ABI checker: use dedicated mangled name field to diagnose man…
artemcm Oct 25, 2021
7882319
Merge pull request #39905 from apple/revert-39904-FixABIStabilitytest
artemcm Oct 25, 2021
52f7203
Merge pull request #39906 from artemcm/RevertBreaqkingABIChange
artemcm Oct 25, 2021
fa4d08a
Fix `_customContainsEquatableElement` implementation for `Stride*` ty…
xwu Oct 25, 2021
687cee9
Merge pull request #37666 from grynspan/jgrynspan/temporary-buffers
grynspan Oct 25, 2021
2ba1dc8
Update `stability-concurrency-abi.test` expected output
artemcm Oct 25, 2021
b8ed3e0
Merge pull request #39909 from artemcm/FixConcurrencyABITest
artemcm Oct 25, 2021
48a23a8
Merge pull request #39901 from al45tair/problem/84571859-2
al45tair Oct 25, 2021
1a3f285
[Sema] Don't check availability in assigned properties initializers
xymus Oct 20, 2021
d2ec6b9
[Frontend] Forbid IR generation with -check-api-availability-only
xymus Oct 20, 2021
f8fb279
improve robustness of dist actor test
kavon Oct 25, 2021
a5c0eb0
[cxx-interop] Fix lazy loading for result types.
zoecarver Oct 25, 2021
2546406
[cxx-interop][nfc] Remove internal header dependency on runtime/stdli…
zoecarver Oct 25, 2021
b8f4aa5
Merge pull request #39898 from AnthonyLatsis/envariant
AnthonyLatsis Oct 26, 2021
1d38759
Merge pull request #39910 from kavon/sturdier-dactor-lifecycle-tests
swift-ci Oct 26, 2021
3927e78
Add to-do for `Stride*` implementation of `_customContainsEquatableEl…
xwu Oct 26, 2021
0184075
Merge pull request #39884 from zoecarver/fix-big-lookup-tables
zoecarver Oct 26, 2021
be52565
Merge pull request #39907 from zoecarver/fix-lazy-loading-result-types
zoecarver Oct 26, 2021
ab45cab
[Distributed] Skip availability checks, checking if distributed is av…
ktoso Oct 26, 2021
40d4349
Disable IRGen tests to unblock CI:
artemcm Oct 26, 2021
3c54fe3
Merge pull request #39919 from artemcm/DisableFailingIRGenTests
artemcm Oct 26, 2021
c209f52
Merge pull request #39911 from zoecarver/decouple-swift-shims
zoecarver Oct 26, 2021
f999870
[SwiftSyntaxBuilder] Add protocol conformance map
kimdv Oct 4, 2021
c60b686
[Concurrency] Re-fix ABI regression in task groups due to Sendable re…
mikeash Oct 26, 2021
bc15343
Merge pull request #39847 from xymus/api-avail-init-properties
xymus Oct 26, 2021
c4f226e
[Driver] Move the flag -check-api-availability-only to the driver
xymus Oct 26, 2021
14be9e7
Merge pull request #39569 from kimdv/kimdv/add-protocols-conformance-map
ahoppen Oct 26, 2021
e961e40
Disable flaky `distributed_actor_init_local.swift` test.
artemcm Oct 26, 2021
6e11611
Merge pull request #39924 from artemcm/DisableDistributedActorInitLocal
artemcm Oct 26, 2021
208b8d4
Fix incorrect precondition test (gt instead of gte) in TemporaryAlloc…
grynspan Oct 26, 2021
a589b4a
[moveOnly] Add an @_noImplicitCopy decl attribute and allow it to be …
gottesmm Sep 15, 2021
825d911
[nfc] Add _builtin suffix to moveonly builtin tests.
gottesmm Oct 26, 2021
2905433
Emit module trace atomically.
artemcm Oct 22, 2021
8aef84c
Merge pull request #39927 from gottesmm/pr-7b7eae43b3c94f52f927ce574f…
gottesmm Oct 26, 2021
889d65d
Re-enable VFE/WME tests, skip LTO-using tests under ASan (#39912)
kubamracek Oct 27, 2021
28b61b8
[moveOnly] Simplify some code as per DougG's review in a589b4a12832f2…
gottesmm Oct 27, 2021
c9e1032
Remove underscores from CFBundleIdentifier of libraries.
DougGregor Oct 27, 2021
7591d44
Propagate Swift version information to the back-deployed binaries
DougGregor Oct 27, 2021
bcf5e97
RequirementMachine: Take concrete substitutions into account when che…
slavapestov Oct 23, 2021
84f02ea
RequirementMachine: Fix crash in simplifyRewriteSystem() with -debug-…
slavapestov Oct 25, 2021
b01e97f
RequirementMachine: Rewrite steps are instructions for a two-stack ma…
slavapestov Oct 25, 2021
97ed28a
RequirementMachine: simplify() supports appending to an existing rewr…
slavapestov Oct 25, 2021
6d89b42
RequirementMachine: Simplify concrete substitutions when adding a new…
slavapestov Oct 25, 2021
5689d04
RequirementMachine: Always add a rule for the trivial [P].[P] => [P] …
slavapestov Oct 23, 2021
74d944d
RequirementMachine: Use llvm::array_pod_sort() to sort requirements
slavapestov Oct 22, 2021
a729beb
RequirementMachine: Improved rule deletion heuristic
slavapestov Oct 22, 2021
a8bc8a8
RequirementMachine: Add assertion to generating conformances algorithm
slavapestov Oct 23, 2021
f44926b
RequirementMachine: Tighten up createRequirementFromRule()
slavapestov Oct 23, 2021
745acea
RequirementMachine: Introduce Rule::isIdentityConformanceRule()
slavapestov Oct 23, 2021
2687e93
RequirementMachine: Proper handling of identity conformances when com…
slavapestov Oct 26, 2021
6d0abdf
Fix infernal Python linter warnings
DougGregor Oct 27, 2021
4aca32c
Disable the definition and use of swift_async_extendedFramePointerFla…
DougGregor Oct 27, 2021
c0154d4
RequirementMachine: Try to delete less canonical conformance rules first
slavapestov Oct 26, 2021
1057b56
RequirementMachine: Rename HomotopyGenerator to RewriteLoop
slavapestov Oct 26, 2021
450c7c2
RequirementMachine: Split off RewriteLoop.cpp from HomotopyReduction.cpp
slavapestov Oct 26, 2021
7d2b22a
RequirementMachine: Fix runtime crash with MSVC
slavapestov Oct 27, 2021
5067bfe
RequirementMachine: Re-organize some methods in RewriteSystem.cpp
slavapestov Oct 27, 2021
c75178e
[Diagnostics] Add a fix-it to insert 'some' when associated type infe…
hborla Oct 27, 2021
0a7272b
Add support for new rebranch
shahmishal Oct 27, 2021
d012208
Merge pull request #39933 from DougGregor/back-deploy-fix-bundle-iden…
swift-ci Oct 27, 2021
bec687d
ConstantFolding: remove a wrong peephole optimization for signed "< 0…
eeckstein Oct 27, 2021
1c0d187
Merge pull request #39931 from gottesmm/pr-57f4f1ba982c2b00e796847447…
gottesmm Oct 27, 2021
295204d
Merge pull request #39920 from mikeash/fix-silgen-name-underscores
mikeash Oct 27, 2021
31b44c8
Merge pull request #39925 from apple/jgrynspan/84672024-fix
grynspan Oct 27, 2021
94355be
Merge pull request #39888 from artemcm/AtomicModuleTrace
artemcm Oct 27, 2021
e51c88d
Merge pull request #39928 from xymus/driver-check-api-only
xymus Oct 27, 2021
08d902f
Merge pull request #39918 from slavapestov/rqm-identity-conformance
slavapestov Oct 27, 2021
5d85ad3
[SILOpt] Add utility to find guaranteed roots.
nate-chandler Oct 26, 2021
3742331
[Test] Removed spurious attribute.
nate-chandler Oct 26, 2021
6b89397
[Test] Improved pattern name.
nate-chandler Oct 27, 2021
30a159b
[NFC] Used already cast value.
nate-chandler Oct 26, 2021
ba2187a
[Diagnostics] Add the opaque type fix-it for failed associated type
hborla Oct 27, 2021
034c0bd
Merge pull request #39926 from gottesmm/pr-5200fb64416d3f915dd48a7f0d…
gottesmm Oct 27, 2021
c39c3e1
Disable IRGen tests to unblock CI:
artemcm Oct 27, 2021
78cb094
Merge pull request #39940 from artemcm/DisableFailingIRGenTests2
artemcm Oct 27, 2021
f0cd714
Rework the watchOS concurrency back-deployment async frame pointer.
DougGregor Oct 27, 2021
26b7cbc
Define `swift_async_extendedFramePointerFlags` for the watchOS simulator
DougGregor Oct 27, 2021
e10bb9f
Workaround to cope with older SDKs
etcwilde Oct 27, 2021
2f6b5b9
Merge pull request #39938 from eeckstein/fix-constant-folding
eeckstein Oct 27, 2021
0fc25cc
[Mem2Reg] Skipped unreachable blocks.
nate-chandler Oct 27, 2021
797eab1
[Mem2Reg] Handled unreachables for single-block allocations.
nate-chandler Oct 25, 2021
0a18c62
[DCE] Keep outer borrows alive when reborrowing.
nate-chandler Oct 26, 2021
a9c2055
Merge pull request #39937 from hborla/opaque-type-fixit
hborla Oct 27, 2021
40da89c
Undefine IB macros when building libswift
Oct 27, 2021
157c742
Merge pull request #39851 from bnbarham/always-add-module-name
bnbarham Oct 27, 2021
9e41e37
Merge pull request #39935 from DougGregor/watchos-noasyncframepointer…
DougGregor Oct 27, 2021
ac85770
[moveOnly] Add a feature for BuiltinMove that we can use to prevent c…
gottesmm Oct 28, 2021
44bd180
[moveOnly] Add a frontend flag -enable-experimental-move-only to cont…
gottesmm Oct 28, 2021
1147897
[moveOnly] Implement a semi-generic _move function that can be used o…
gottesmm Oct 24, 2021
5e43702
[DepScanner] Do not remove the resource directory path
bnbarham Oct 28, 2021
60f3d61
Merge pull request #39943 from gottesmm/pr-65ca66f5402c00e0f0fa060840…
gottesmm Oct 28, 2021
495bd36
ABIChecker: teach wmo mode to emit ABI descriptor files
nkcsgexi Oct 28, 2021
cca1312
Update SwiftWindowsSupport.cmake
compnerd Oct 28, 2021
35ea326
Amend _swift_stdlib_getCurrentStackBounds() to do nothing when SWIFT_…
grynspan Oct 28, 2021
6056172
[moveOnly] Move @_noImplicitCopy behind the flag -enable-experimental…
gottesmm Oct 28, 2021
ea4f20a
Merge pull request #39949 from nkcsgexi/wmo-abi-json
nkcsgexi Oct 28, 2021
1b3fa26
Merge pull request #39883 from nate-chandler/lexical_lifetimes/avoid-…
nate-chandler Oct 28, 2021
e5d0f38
[moveOnly] Add a new experimental move only checker that checks noImp…
gottesmm Oct 22, 2021
2d179ce
Merge pull request #39954 from gottesmm/pr-2c18478a1d9b0c30c530be2c68…
gottesmm Oct 28, 2021
2862531
Merge pull request #39941 from etcwilde/ewilde/concurrency/handle-mis…
etcwilde Oct 28, 2021
0f30978
Merge pull request #39866 from guitard0g/temp_undef_ib_macros
Oct 28, 2021
4a56efe
Merge pull request #39956 from gottesmm/pr-c8f8cf9d6d3aa0800cc5fae25e…
gottesmm Oct 28, 2021
8e48fd6
Merge pull request #39930 from nate-chandler/lexical_lifetimes/mem2re…
nate-chandler Oct 28, 2021
0336167
Merge pull request #39939 from nate-chandler/dce/keep-outer-borrow-sc…
nate-chandler Oct 28, 2021
d71d31c
Merge pull request #39945 from bnbarham/do-not-remove-resource-dir
bnbarham Oct 28, 2021
cd610b8
Merge pull request #39952 from apple/compnerd/foreign-cross-compiling
compnerd Oct 28, 2021
300bd98
Merge pull request #39953 from apple/jgrynspan/84739108-symbol-list
grynspan Oct 29, 2021
a607ea9
Merge remote-tracking branch 'apple/main' into katei/merge-main-2021-…
kateinoigakukun Oct 29, 2021
2424048
[test] disable crash tests in stdlib/TemporaryAllocation.swift for wasi
kateinoigakukun Oct 29, 2021
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
3 changes: 2 additions & 1 deletion cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ function(add_libswift name)

set(libswift_compile_options
"-Xfrontend" "-validate-tbd-against-ir=none"
"-Xfrontend" "-enable-cxx-interop")
"-Xfrontend" "-enable-cxx-interop"
"-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable")

if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND libswift_compile_options "-g")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/SwiftWindowsSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ endfunction()
# NOTE(compnerd) we use a macro here as this modifies global variables
macro(swift_swap_compiler_if_needed target)
if(NOT CMAKE_C_COMPILER_ID MATCHES Clang)
if(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
if(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
if(SWIFT_BUILT_STANDALONE)
get_target_property(CLANG_LOCATION clang LOCATION)
get_filename_component(CLANG_LOCATION ${CLANG_LOCATION} DIRECTORY)
Expand Down
5 changes: 5 additions & 0 deletions docs/ReferenceGuides/UnderscoredAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,8 @@ within Swift 5 code that has adopted concurrency, but non-`@MainActor`

See the forum post on [Concurrency in Swift 5 and 6](https://forums.swift.org/t/concurrency-in-swift-5-and-6/49337)
for more details.

## `@_noImplicitCopy`

Marks a var decl as a variable that must be copied explicitly using the builtin
function Builtin.copy.
3 changes: 1 addition & 2 deletions include/swift/APIDigester/ModuleAnalyzerNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,12 @@ class SDKNodeDecl: public SDKNode {
Optional<uint8_t> FixedBinaryOrder;
PlatformIntroVersion introVersions;
StringRef ObjCName;
mutable Optional<StringRef> demangledName;

protected:
SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind);
virtual ~SDKNodeDecl() = default;
public:
StringRef getUsr() const { return Usr; }
StringRef getDemangledName() const;
StringRef getLocation() const { return Location; }
StringRef getModuleName() const {return ModuleName;}
StringRef getHeaderName() const;
Expand Down
7 changes: 7 additions & 0 deletions include/swift/AST/Attr.def
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ DECL_ATTR(_nonSendable, NonSendable,
APIStableToAdd | APIBreakingToRemove,
121)

SIMPLE_DECL_ATTR(_noImplicitCopy, NoImplicitCopy,
UserInaccessible |
ABIStableToAdd | ABIBreakingToRemove |
APIStableToAdd | APIBreakingToRemove |
OnVar,
122)

// If you're adding a new underscored attribute here, please document it in
// docs/ReferenceGuides/UnderscoredAttributes.md.

Expand Down
39 changes: 36 additions & 3 deletions include/swift/AST/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,6 @@ BUILTIN_SIL_OPERATION(WithUnsafeThrowingContinuation, "withUnsafeThrowingContinu
/// Force the current task to be rescheduled on the specified actor.
BUILTIN_SIL_OPERATION(HopToActor, "hopToActor", None)

/// Generate a move_value instruction to convert a T to a @_moveOnly T.
BUILTIN_SIL_OPERATION(Move, "move", Special)

#undef BUILTIN_SIL_OPERATION

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

/// StackAlloc has type (Int, Int, Int) -> Builtin.RawPointer
///
/// Parameters: capacity, stride, alignment
///
/// The resulting pointer comes from the stack (as in the non-standard C
/// extension `alloca()`.) It is at least as aligned as specified and is valid
/// until the end of the calling scope.
///
/// The count and stride are multiplied together to get the byte count to use
/// for the allocation.
///
/// The passed alignment must be a positive power of two. If the alignment value
/// is not known at compile time, MaximumAlignment is assumed.
BUILTIN_MISC_OPERATION(StackAlloc, "stackAlloc", "", Special)

/// StackDealloc has type (Builtin.RawPointer) -> ()
///
/// Parameters: address.
///
/// The range starting at `address`, previously allocated with
/// Builtin.stackAlloc(), is deallocated from the stack.
BUILTIN_MISC_OPERATION(StackDealloc, "stackDealloc", "", Special)

/// Fence has type () -> ().
BUILTIN_MISC_OPERATION(Fence, "fence", "", None)

Expand Down Expand Up @@ -757,6 +777,19 @@ BUILTIN_MISC_OPERATION(CreateTaskGroup,
BUILTIN_MISC_OPERATION(DestroyTaskGroup,
"destroyTaskGroup", "", Special)


/// A builtin that can only be called from a transparent generic function. Takes
/// two operands, the first operand the result address, the second operand the
/// input address. Transforms into load [take] + move_value + store [init] when
/// transparently inlined into a caller that has the generic of the callee
/// specialized into a loadable type. If the transparent inlining does not
/// specialize the type (due to being inlined into a non-generic context, the
/// SILVerifier will abort).
///
/// Illegal to call except for in Swift._move in the stdlib. This is enforced by
/// the SILVerifier.
BUILTIN_MISC_OPERATION(Move, "move", "", Special)

// BUILTIN_MISC_OPERATION_WITH_SILGEN - Miscellaneous operations that are
// specially emitted during SIL generation.
//
Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ ERROR(error_mode_cannot_emit_module_semantic_info,none,
ERROR(cannot_emit_ir_skipping_function_bodies,none,
"the -experimental-skip-*-function-bodies* flags do not support "
"emitting IR", ())
ERROR(cannot_emit_ir_checking_api_availability_only,none,
"the flag -check-api-availability-only does not support "
"emitting IR", ())

WARNING(emit_reference_dependencies_without_primary_file,none,
"ignoring -emit-reference-dependencies (requires -primary-file)", ())
Expand Down
9 changes: 9 additions & 0 deletions include/swift/AST/DiagnosticsIRGen.def
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,14 @@ ERROR(alignment_more_than_maximum,none,
"@_alignment cannot increase alignment above maximum alignment of %0",
(unsigned))

ERROR(temporary_allocation_size_negative,none,
"allocation capacity must be greater than or equal to zero", ())
ERROR(temporary_allocation_size_overflow,none,
"allocation byte count too large", ())
ERROR(temporary_allocation_alignment_not_positive,none,
"alignment value must be greater than zero", ())
ERROR(temporary_allocation_alignment_not_power_of_2,none,
"alignment value must be a power of two", ())

#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
15 changes: 15 additions & 0 deletions include/swift/AST/DiagnosticsSIL.def
Original file line number Diff line number Diff line change
Expand Up @@ -686,5 +686,20 @@ NOTE(capturepromotion_concurrentcapture_capturinguse_here, none,
NOTE(capturepromotion_variable_defined_here,none,
"variable defined here", ())

// move operator used on generic or evalue
ERROR(move_operator_used_on_generic_or_existential_value, none,
"move() used on a generic or existential value", ())

// noimplicitcopy on generic or existential binding
ERROR(noimplicitcopy_used_on_generic_or_existential, none,
"@_noImplicitCopy can not be used on a generic or existential typed "
"binding or a nominal type containing such typed things", ())

// move only checker diagnostics
ERROR(sil_moveonlychecker_value_consumed_more_than_once, none,
"'%0' consumed more than once", (StringRef))
NOTE(sil_moveonlychecker_consuming_use_here, none,
"consuming use", ())

#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
16 changes: 16 additions & 0 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -2263,6 +2263,11 @@ NOTE(associated_type_witness_conform_impossible,none,
"candidate can not infer %0 = %1 because %1 "
"is not a nominal type and so can't conform to %2",
(Identifier, Type, Type))
NOTE(suggest_opaque_type_witness,none,
"cannot infer %0 = %1 because %1 as a type cannot "
"conform to protocols; did you mean to use an opaque "
"result type?",
(Identifier, Type, Type))
NOTE(associated_type_witness_inherit_impossible,none,
"candidate can not infer %0 = %1 because %1 "
"is not a class type and so can't inherit from %2",
Expand Down Expand Up @@ -6029,5 +6034,16 @@ ERROR(wrap_invalid_attr_added_by_access_note, none,

#undef WHICH_ACCESS_NOTE

// Move Only diagnostics

ERROR(experimental_moveonly_feature_can_only_be_used_when_enabled,
none, "Can not use feature when experimental move only is disabled! Pass"
" the frontend flag -enable-experimental-move-only to swift to enable "
"the usage of this language feature", ())
ERROR(noimplicitcopy_attr_valid_only_on_local_let,
none, "'@_noImplicitCopy' attribute can only be applied to local lets", ())
ERROR(noimplicitcopy_attr_invalid_in_generic_context,
none, "'@_noImplicitCopy' attribute cannot be applied to entities in generic contexts", ())

#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
2 changes: 2 additions & 0 deletions include/swift/AST/SemanticAttrs.def
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@ SEMANTICS_ATTR(FORCE_EMIT_OPT_REMARK_PREFIX, "optremark")
/// for testing purposes.
SEMANTICS_ATTR(OBJC_FORBID_ASSOCIATED_OBJECTS, "objc.forbidAssociatedObjects")

SEMANTICS_ATTR(LIFETIMEMANAGEMENT_MOVE, "lifetimemanagement.move")

#undef SEMANTICS_ATTR

3 changes: 0 additions & 3 deletions include/swift/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ class Type {
LookupConformanceFn conformances,
SubstOptions options=None) const;

/// Replace references to substitutable types with error types.
Type substDependentTypesWithErrorTypes() const;

bool isPrivateStdlibType(bool treatNonBuiltinProtocolsAsPublic = true) const;

SWIFT_DEBUG_DUMP;
Expand Down
7 changes: 2 additions & 5 deletions include/swift/AST/USRGeneration.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ bool printExtensionUSR(const ExtensionDecl *ED, raw_ostream &OS);
/// \returns true if it failed, false on success.
bool printDeclUSR(const Decl *D, raw_ostream &OS);

/// Get mangled name from a USR.
std::string getMangledNameFromUSR(StringRef usr);

/// Demangle a mangled name to a human readable name.
std::string demangleMangledName(StringRef mangled);
/// Demangle a mangle-name-based USR to a human readable name.
std::string demangleUSR(StringRef mangled);

} // namespace ide
} // namespace swift
Expand Down
1 change: 1 addition & 0 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true
LANGUAGE_FEATURE(BuiltinBuildExecutor, 0, "Executor-building builtins", true)
LANGUAGE_FEATURE(BuiltinBuildMainExecutor, 0, "MainActor executor building builtin", true)
LANGUAGE_FEATURE(BuiltinCreateAsyncTaskInGroup, 0, "MainActor executor building builtin", true)
LANGUAGE_FEATURE(BuiltinMove, 0, "Builtin.move()", true)

#undef LANGUAGE_FEATURE
3 changes: 3 additions & 0 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ namespace swift {
/// Enable experimental 'distributed' actors and functions.
bool EnableExperimentalDistributed = false;

/// Enable experimental 'move only' features.
bool EnableExperimentalMoveOnly = false;

/// Disable the implicit import of the _Concurrency module.
bool DisableImplicitConcurrencyModuleImport =
!SWIFT_IMPLICIT_CONCURRENCY_IMPORT;
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Demangling/Demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#define SWIFT_DEMANGLING_DEMANGLE_H

#include "swift/Demangling/NamespaceMacros.h"
#include "swift/Runtime/Config.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstdint>
#include <memory>
Expand Down Expand Up @@ -514,7 +514,7 @@ enum class OperatorKind {
};

/// A mangling error, which consists of an error code and a Node pointer
struct SWIFT_NODISCARD ManglingError {
struct LLVM_NODISCARD ManglingError {
enum Code {
Success = 0,
AssertionFailed,
Expand Down Expand Up @@ -556,7 +556,7 @@ struct SWIFT_NODISCARD ManglingError {

/// Used as a return type for mangling functions that may fail
template <typename T>
class SWIFT_NODISCARD ManglingErrorOr {
class LLVM_NODISCARD ManglingErrorOr {
private:
ManglingError err_;
T value_;
Expand Down
1 change: 1 addition & 0 deletions include/swift/Demangling/TypeLookupError.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ static TypeLookupError TypeLookupErrorImpl(const char *fmt, Args... args) {
char *str;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
#pragma clang diagnostic ignored "-Wformat-nonliteral"
swift_asprintf(&str, fmt, args...);
#pragma clang diagnostic pop
return str;
Expand Down
8 changes: 4 additions & 4 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ def enable_experimental_lexical_lifetimes :
Flag<["-"], "enable-experimental-lexical-lifetimes">,
HelpText<"Enable experimental lexical lifetimes">;

def enable_experimental_move_only :
Flag<["-"], "enable-experimental-move-only">,
HelpText<"Enable experimental move only">;

def enable_experimental_distributed :
Flag<["-"], "enable-experimental-distributed">,
HelpText<"Enable experimental 'distributed' actors and functions">;
Expand Down Expand Up @@ -469,10 +473,6 @@ def disable_availability_checking : Flag<["-"],
"disable-availability-checking">,
HelpText<"Disable checking for potentially unavailable APIs">;

def check_api_availability_only : Flag<["-"],
"check-api-availability-only">,
HelpText<"Only check the availability of the APIs, ignore function bodies">;

def enable_conformance_availability_errors : Flag<["-"],
"enable-conformance-availability-errors">,
HelpText<"Diagnose conformance availability violations as errors">;
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ def define_availability : Separate<["-"], "define-availability">,
HelpText<"Define an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'">,
MetaVarName<"<macro>">;

def check_api_availability_only : Flag<["-"], "check-api-availability-only">,
Flags<[HelpHidden, FrontendOption, NoInteractiveOption]>,
HelpText<"Only check the availability of the APIs, ignore function bodies">;

def library_level : Separate<["-"], "library-level">,
MetaVarName<"<level>">,
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
Expand Down
16 changes: 16 additions & 0 deletions include/swift/Runtime/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
// so changing this value is not sufficient.
#define SWIFT_DEFAULT_LLVM_CC llvm::CallingConv::C

// SWIFT_FORMAT(fmt,first) marks a function as taking a format string argument
// at argument `fmt`, with the first argument for the format string as `first`.
#if __has_attribute(format)
#define SWIFT_FORMAT(fmt,first) __attribute__((format(printf, fmt, first)))
#else
#define SWIFT_FORMAT(fmt,first)
#endif

// SWIFT_VFORMAT(fmt) marks a function as taking a format string argument at
// argument `fmt`, with the arguments in a `va_list`.
#if __has_attribute(format)
#define SWIFT_VFORMAT(fmt) __attribute__((format(printf, fmt, 0)))
#else
#define SWIFT_VFORMAT(fmt)
#endif

// Pointer authentication.
#if __has_feature(ptrauth_calls)
#define SWIFT_PTRAUTH 1
Expand Down
3 changes: 3 additions & 0 deletions include/swift/Runtime/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,18 @@ static inline void crash(const char *message) {
// swift::fatalError() halts with a crash log message,
// but makes no attempt to preserve register state.
SWIFT_RUNTIME_ATTRIBUTE_NORETURN
SWIFT_FORMAT(2, 3)
extern void
fatalError(uint32_t flags, const char *format, ...);

/// swift::warning() emits a warning from the runtime.
extern void
SWIFT_VFORMAT(2)
warningv(uint32_t flags, const char *format, va_list args);

/// swift::warning() emits a warning from the runtime.
extern void
SWIFT_FORMAT(2, 3)
warning(uint32_t flags, const char *format, ...);

// swift_dynamicCastFailure halts using fatalError()
Expand Down
12 changes: 12 additions & 0 deletions include/swift/SIL/DebugUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ inline SILInstruction *getSingleNonDebugUser(SILValue V) {
return I->getUser();
}

/// If \p value has a single debug user, return the operand associated with that
/// use. Otherwise, returns nullptr.
inline Operand *getSingleDebugUse(SILValue value) {
auto range = getDebugUses(value);
auto ii = range.begin(), ie = range.end();
if (ii == ie)
return nullptr;
if (std::next(ii) != ie)
return nullptr;
return *ii;
}

/// Erases the instruction \p I from it's parent block and deletes it, including
/// all debug instructions which use \p I.
/// Precondition: The instruction may only have debug instructions as uses.
Expand Down
5 changes: 5 additions & 0 deletions include/swift/SIL/MemAccessUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ SILValue findReferenceRoot(SILValue ref);
/// Find the first owned root of the reference.
SILValue findOwnershipReferenceRoot(SILValue ref);

/// Look through all ownership forwarding instructions to find the values which
/// were originally borrowed.
void findGuaranteedReferenceRoots(SILValue value,
SmallVectorImpl<SILValue> &roots);

/// Find the aggregate containing the first owned root of the
/// reference. Identical to findOwnershipReferenceRoot, but looks through
/// struct_extract, tuple_extract, etc.
Expand Down
3 changes: 3 additions & 0 deletions include/swift/SIL/SILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ class SILType {
/// Get the SIL token type.
static SILType getSILTokenType(const ASTContext &C);

/// Return '()'
static SILType getEmptyTupleType(const ASTContext &C);

//
// Utilities for treating SILType as a pointer-like type.
//
Expand Down
Loading