Skip to content

Commit 64780f8

Browse files
Merge pull request #3032 from swiftwasm/maxd/main-merge
Fix issues when merging the `main` branch
2 parents 1470d5e + 5d14b0a commit 64780f8

File tree

139 files changed

+1589
-861
lines changed

Some content is hidden

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

139 files changed

+1589
-861
lines changed

cmake/modules/DarwinSDKs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif()
1313
set(SUPPORTED_TVOS_ARCHS "arm64")
1414
set(SUPPORTED_TVOS_SIMULATOR_ARCHS "x86_64;arm64")
1515
set(SUPPORTED_WATCHOS_ARCHS "armv7k;arm64_32")
16-
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;arm64")
16+
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;x86_64;arm64")
1717
set(SUPPORTED_OSX_ARCHS "x86_64;arm64;arm64e")
1818

1919
is_sdk_requested(OSX swift_build_osx)

include/swift/ABI/Metadata.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4897,6 +4897,9 @@ struct DynamicReplacementKey {
48974897
uint16_t getExtraDiscriminator() const {
48984898
return flags & 0x0000FFFF;
48994899
}
4900+
bool isAsync() const {
4901+
return ((flags >> 16 ) & 0x1);
4902+
}
49004903
};
49014904

49024905
/// A record describing a dynamic function replacement.

include/swift/AST/ASTContext.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,13 @@ class ASTContext final {
885885
/// If there is no Clang module loader, returns a null pointer.
886886
/// The loader is owned by the AST context.
887887
ClangModuleLoader *getDWARFModuleLoader() const;
888+
889+
/// Check whether the module with a given name can be imported without
890+
/// importing it.
891+
///
892+
/// Note that even if this check succeeds, errors may still occur if the
893+
/// module is loaded in full.
894+
bool canImportModuleImpl(ImportPath::Element ModulePath) const;
888895
public:
889896
namelookup::ImportCache &getImportCache() const;
890897

@@ -914,6 +921,7 @@ class ASTContext final {
914921
/// Note that even if this check succeeds, errors may still occur if the
915922
/// module is loaded in full.
916923
bool canImportModule(ImportPath::Element ModulePath);
924+
bool canImportModule(ImportPath::Element ModulePath) const;
917925

918926
/// \returns a module with a given name that was already loaded. If the
919927
/// module was not loaded, returns nullptr.

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ ERROR(cannot_emit_ir_skipping_function_bodies,none,
136136
WARNING(emit_reference_dependencies_without_primary_file,none,
137137
"ignoring -emit-reference-dependencies (requires -primary-file)", ())
138138

139+
WARNING(warn_implicit_concurrency_import_failed,none,
140+
"unable to perform implicit import of \"_Concurrency\" module: no such module found", ())
141+
139142
ERROR(error_module_name_required,none, "-module-name is required", ())
140143
ERROR(error_bad_module_name,none,
141144
"module name \"%0\" is not a valid identifier"

include/swift/AST/DiagnosticsSema.def

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4351,8 +4351,8 @@ NOTE(objc_ambiguous_async_convention_candidate,none,
43514351
ERROR(async_objc_dynamic_self,none,
43524352
"asynchronous method returning 'Self' cannot be '@objc'", ())
43534353

4354-
ERROR(actor_with_nonactor_superclass,none,
4355-
"actor cannot inherit from non-actor class %0", (DeclName))
4354+
ERROR(actor_inheritance,none,
4355+
"actor types do not support inheritance", ())
43564356

43574357
ERROR(actor_isolated_non_self_reference,none,
43584358
"actor-isolated %0 %1 can only be %select{referenced|mutated|used 'inout'}3 "
@@ -4426,6 +4426,9 @@ NOTE(actor_isolated_sync_func,none,
44264426
NOTE(actor_mutable_state,none,
44274427
"mutation of this %0 is only permitted within the actor",
44284428
(DescriptiveDeclKind))
4429+
NOTE(actor_isolated_let,none,
4430+
"use `nonisolated` to allow synchronous access to 'let' from outside "
4431+
"the actor", ())
44294432
WARNING(shared_mutable_state_access,none,
44304433
"reference to %0 %1 is not concurrency-safe because it involves "
44314434
"shared mutable state", (DescriptiveDeclKind, DeclName))
@@ -4458,13 +4461,12 @@ WARNING(non_concurrent_property_type,none,
44584461
WARNING(non_concurrent_keypath_capture,none,
44594462
"cannot form key path that captures non-sendable type %0",
44604463
(Type))
4461-
WARNING(non_concurrent_keypath_access,none,
4462-
"cannot form key path that accesses non-sendable type %0",
4463-
(Type))
44644464
ERROR(non_concurrent_type_member,none,
44654465
"%select{stored property %1|associated value %1}0 of "
44664466
"'Sendable'-conforming %2 %3 has non-sendable type %4",
44674467
(bool, DeclName, DescriptiveDeclKind, DeclName, Type))
4468+
ERROR(non_sendable_nonisolated_let,none,
4469+
"non-isolated let property %0 has non-Sendable type %1", (DeclName, Type))
44684470
ERROR(concurrent_value_class_mutable_property,none,
44694471
"stored property %0 of 'Sendable'-conforming %1 %2 is mutable",
44704472
(DeclName, DescriptiveDeclKind, DeclName))
@@ -4480,21 +4482,13 @@ ERROR(concurrent_value_inherit,none,
44804482
"%select{| other than 'NSObject'}0",
44814483
(bool, DeclName))
44824484

4483-
ERROR(actorindependent_let,none,
4484-
"'@actorIndependent' is meaningless on 'let' declarations because "
4485-
"they are immutable",
4486-
())
44874485
ERROR(actorindependent_mutable_storage,none,
44884486
"'@actorIndependent' can not be applied to stored properties",
44894487
())
44904488
ERROR(actorindependent_local_var,none,
44914489
"'@actorIndependent' can not be applied to local variables",
44924490
())
44934491

4494-
ERROR(nonisolated_let,none,
4495-
"'nonisolated' is meaningless on 'let' declarations because "
4496-
"they are immutable",
4497-
())
44984492
ERROR(nonisolated_mutable_storage,none,
44994493
"nonisolated' can not be applied to stored properties",
45004494
())
@@ -5678,8 +5672,8 @@ ERROR(wrapped_value_mismatch, none,
56785672
"property type %0 does not match 'wrappedValue' type %1",
56795673
(Type, Type))
56805674
ERROR(composed_property_wrapper_mismatch, none,
5681-
"composed wrapper type %0 does not match former 'wrappedValue' type %1",
5682-
(Type, Type))
5675+
"composed wrapper type %0 does not match type of '%1.wrappedValue', which is %2",
5676+
(Type, StringRef, Type))
56835677

56845678
ERROR(property_wrapper_type_access,none,
56855679
"%select{%select{variable|constant}0|property}1 "

include/swift/AST/Stmt.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,16 @@ class SwitchStmt final : public LabeledStmt,
11351135
SourceLoc RBraceLoc,
11361136
SourceLoc EndLoc,
11371137
ASTContext &C);
1138-
1138+
1139+
static SwitchStmt *createImplicit(LabeledStmtInfo LabelInfo,
1140+
Expr *SubjectExpr, ArrayRef<ASTNode> Cases,
1141+
ASTContext &C) {
1142+
return SwitchStmt::create(LabelInfo, /*SwitchLoc=*/SourceLoc(), SubjectExpr,
1143+
/*LBraceLoc=*/SourceLoc(), Cases,
1144+
/*RBraceLoc=*/SourceLoc(), /*EndLoc=*/SourceLoc(),
1145+
C);
1146+
}
1147+
11391148
/// Get the source location of the 'switch' keyword.
11401149
SourceLoc getSwitchLoc() const { return SwitchLoc; }
11411150
/// Get the source location of the opening brace.

include/swift/Basic/Features.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ LANGUAGE_FEATURE(RethrowsProtocol, 0, "@rethrows protocol", true)
4343
LANGUAGE_FEATURE(GlobalActors, 0, "Global actors", langOpts.EnableExperimentalConcurrency)
4444
LANGUAGE_FEATURE(BuiltinJob, 0, "Builtin.Job type", true)
4545
LANGUAGE_FEATURE(Sendable, 0, "Sendable and @Sendable", true)
46+
LANGUAGE_FEATURE(BuiltinExecutor, 0, "Executor builtins", true)
4647
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
4748
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
49+
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
4850

4951
#undef LANGUAGE_FEATURE

include/swift/Basic/FileTypes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ TYPE("index-unit-output-path", IndexUnitOutputPath, "", "")
8383
TYPE("yaml-opt-record", YAMLOptRecord, "opt.yaml", "")
8484
TYPE("bitstream-opt-record",BitstreamOptRecord, "opt.bitstream", "")
8585

86-
TYPE("symbol-graph-output-path", SymbolGraphOutputPath, "", "")
87-
8886
// Overlay files declare wrapper modules, called "separately-imported overlays",
8987
// that should be automatically imported when a particular module is imported.
9088
// Cross-import directories conditionalize overlay files so they only take

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ struct SupplementaryOutputPaths {
152152

153153
/// The path to which we should emit module summary file.
154154
std::string ModuleSummaryOutputPath;
155-
156-
/// The directory to which we should emit symbol graphs for the current module.
157-
std::string SymbolGraphOutputDir;
158155

159156
SupplementaryOutputPaths() = default;
160157
SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default;
@@ -189,8 +186,6 @@ struct SupplementaryOutputPaths {
189186
fn(LdAddCFilePath);
190187
if (!ModuleSummaryOutputPath.empty())
191188
fn(ModuleSummaryOutputPath);
192-
if (!SymbolGraphOutputDir.empty())
193-
fn(SymbolGraphOutputDir);
194189
}
195190

196191
bool empty() const {
@@ -199,8 +194,7 @@ struct SupplementaryOutputPaths {
199194
ReferenceDependenciesFilePath.empty() &&
200195
SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() &&
201196
TBDPath.empty() && ModuleInterfaceOutputPath.empty() &&
202-
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty() &&
203-
SymbolGraphOutputDir.empty();
197+
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty();
204198
}
205199
};
206200
} // namespace swift

include/swift/Driver/Driver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,6 @@ class Driver {
416416
const TypeToPathMap *OutputMap,
417417
StringRef workingDirectory,
418418
CommandOutput *Output) const;
419-
420-
void chooseSymbolGraphOutputPath(Compilation &C,
421-
const TypeToPathMap *OutputMap,
422-
StringRef workingDirectory,
423-
CommandOutput *Output) const;
424419

425420
void chooseLoadedModuleTracePath(Compilation &C,
426421
StringRef workingDirectory,

include/swift/Frontend/Frontend.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,14 @@ class CompilerInstance {
529529
return getMainModule()->getPrimarySourceFiles();
530530
}
531531

532+
/// Verify that if an implicit import of the `Concurrency` module if expected,
533+
/// it can actually be imported. Emit a warning, otherwise.
534+
void verifyImplicitConcurrencyImport();
535+
536+
/// Whether the Swift Concurrency support library can be imported
537+
/// i.e. if it can be found.
538+
bool canImportSwiftConcurrency() const;
539+
532540
/// Gets the SourceFile which is the primary input for this CompilerInstance.
533541
/// \returns the primary SourceFile, or nullptr if there is no primary input;
534542
/// if there are _multiple_ primary inputs, fails with an assertion.

include/swift/Option/FrontendOptions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def disable_swift3_objc_inference :
431431

432432
def library_level : Separate<["-"], "library-level">,
433433
MetaVarName<"<level>">,
434-
Flags<[FrontendOption]>,
434+
Flags<[FrontendOption, ModuleInterfaceOption]>,
435435
HelpText<"Library distribution level 'api', 'spi' or 'other' (the default)">;
436436

437437
def enable_implicit_dynamic : Flag<["-"], "enable-implicit-dynamic">,

include/swift/Runtime/BackDeployment.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

include/swift/Runtime/Bincompat.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@ namespace bincompat {
2222

2323
/// Whether protocol conformance iteration should be reversed, to prefer
2424
/// conformances from images that are later in the list over earlier ones.
25+
/// Default is false starting with Swift 5.4.
2526
bool workaroundProtocolConformanceReverseIteration();
2627

28+
/// Whether we should crash when we encounter a non-nullable Obj-C
29+
/// reference with a null value as the source of a cast.
30+
/// Default is true starting with Swift 5.4.
31+
bool unexpectedObjCNullWhileCastingIsFatal();
32+
33+
/// Whether we should use the legacy semantics for casting nil optionals
34+
/// to nested optionals
35+
bool useLegacyOptionalNilInjection();
36+
2737
} // namespace bincompat
2838

2939
} // namespace runtime

include/swift/Runtime/Concurrency.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,10 @@ SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
642642
void swift_task_reportUnexpectedExecutor(
643643
const unsigned char *file, uintptr_t fileLength, bool fileIsASCII,
644644
uintptr_t line, ExecutorRef executor);
645+
646+
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
647+
JobPriority swift_task_getCurrentThreadPriority(void);
648+
645649
}
646650

647651
#pragma clang diagnostic pop

include/swift/Runtime/Config.h

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,34 +100,21 @@
100100
/// from ObjC classes?
101101
#ifndef SWIFT_CLASS_IS_SWIFT_MASK
102102

103-
// Non-Apple platforms always use 1.
104-
# if !defined(__APPLE__)
105-
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
106-
107-
// Builds for Swift-in-the-OS always use 2.
108-
# elif SWIFT_BNI_OS_BUILD
109-
# define SWIFT_CLASS_IS_SWIFT_MASK 2ULL
110-
111-
// Builds for Xcode always use 1.
112-
# elif SWIFT_BNI_XCODE_BUILD
113-
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
114-
115103
// Compatibility hook libraries cannot rely on the "is swift" bit being either
116104
// value, since they must work with both OS and Xcode versions of the libraries.
117105
// Generate a reference to a nonexistent symbol so that we get obvious linker
118106
// errors if we try.
119-
# elif SWIFT_COMPATIBILITY_LIBRARY
107+
# if SWIFT_COMPATIBILITY_LIBRARY
120108
extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTLY__;
121109
# define SWIFT_CLASS_IS_SWIFT_MASK __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTLY__
122110

123-
// Other builds (such as local builds on developers' computers)
124-
// dynamically choose the bit at runtime based on the current OS
125-
// version.
111+
// Apple platforms always use 2
112+
# elif defined(__APPLE__)
113+
# define SWIFT_CLASS_IS_SWIFT_MASK 2ULL
114+
115+
// Non-Apple platforms always use 1.
126116
# else
127-
# define SWIFT_CLASS_IS_SWIFT_MASK _swift_classIsSwiftMask
128-
# define SWIFT_CLASS_IS_SWIFT_MASK_GLOBAL_VARIABLE 1
129-
# define SWIFT_BUILD_HAS_BACK_DEPLOYMENT 1
130-
# include "BackDeployment.h"
117+
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
131118

132119
# endif
133120
#endif

include/swift/SIL/SILFunction.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,19 +1020,12 @@ class SILFunction
10201020

10211021
/// Transfer all blocks of \p F into this function, at the begin of the block
10221022
/// list.
1023-
void moveAllBlocksFromOtherFunction(SILFunction *F) {
1024-
BlockList.splice(begin(), F->BlockList);
1025-
}
1023+
void moveAllBlocksFromOtherFunction(SILFunction *F);
10261024

10271025
/// Transfer \p blockInOtherFunction of another function into this function,
10281026
/// before \p insertPointInThisFunction.
10291027
void moveBlockFromOtherFunction(SILBasicBlock *blockInOtherFunction,
1030-
iterator insertPointInThisFunction) {
1031-
SILFunction *otherFunc = blockInOtherFunction->getParent();
1032-
assert(otherFunc != this);
1033-
BlockList.splice(insertPointInThisFunction, otherFunc->BlockList,
1034-
blockInOtherFunction);
1035-
}
1028+
iterator insertPointInThisFunction);
10361029

10371030
/// Move block \p BB to immediately before the iterator \p IP.
10381031
///

0 commit comments

Comments
 (0)