Skip to content

Commit 051f13c

Browse files
committed
Merge branch 'main' of github.com:apple/swift into maxd/main-merge
# Conflicts: # stdlib/private/CMakeLists.txt # test/CMakeLists.txt
2 parents 7a04fb3 + 14350f8 commit 051f13c

File tree

199 files changed

+7520
-2813
lines changed

Some content is hidden

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

199 files changed

+7520
-2813
lines changed

docs/ContinuousIntegration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ preset=buildbot,tools=RA,stdlib=RD,test=non_executable
215215

216216
### Build and Test the Minimal Freestanding Stdlib using Toolchain Specific Preset Testing
217217

218-
To test the minimal freestanding stdlib on macho, you can use the support for running a miscellanous preset against a snapshot toolchain.
218+
To test the minimal freestanding stdlib on macho, you can use the support for running a miscellaneous preset against a snapshot toolchain.
219219

220220
```
221221
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test

docs/DifferentiableProgramming.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,12 @@ The synthesized `TangentVector` has the same effective access level as the
12731273
original type declaration. Properties in the synthesized `TangentVector` have
12741274
the same effective access level as their corresponding original properties.
12751275

1276+
The synthesized `TangentVector` adopts protocols from all `TangentVector`
1277+
conformance constraints implied by the declaration that triggers synthesis. For
1278+
example, synthesized `TangentVector`s always adopt the `AdditiveArithmetic` and
1279+
`Differentiable` protocols because the `Differentiable` protocol requires that
1280+
`TangentVector` conforms to `AdditiveArithmetic` and `Differentiable`.
1281+
12761282
The synthesized `move(along:)` method calls `move(along:)` for each pair of a
12771283
differentiable variable and its corresponding property in `TangentVector`.
12781284

include/swift/ABI/Class.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ enum class ObjCClassFlags : uint32_t {
5353
/// This class provides a non-trivial .cxx_destruct method, but
5454
/// its .cxx_construct is trivial. For backwards compatibility,
5555
/// when setting this flag, HasCXXStructors must be set as well.
56-
HasCXXDestructorOnly = 0x00100
56+
HasCXXDestructorOnly = 0x00100,
57+
58+
/// This class does not allow associated objects on instances.
59+
///
60+
/// Will cause the objc runtime to trap in objc_setAssociatedObject.
61+
ForbidsAssociatedObjects = 0x00400,
5762
};
5863
inline ObjCClassFlags &operator|=(ObjCClassFlags &lhs, ObjCClassFlags rhs) {
5964
lhs = ObjCClassFlags(uint32_t(lhs) | uint32_t(rhs));

include/swift/AST/ASTContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ class ASTContext final {
713713
/// Get the runtime availability of support for concurrency.
714714
AvailabilityContext getConcurrencyAvailability();
715715

716+
/// Get the runtime availability of support for differentiation.
717+
AvailabilityContext getDifferentiationAvailability();
718+
716719
/// Get the runtime availability of features introduced in the Swift 5.2
717720
/// compiler for the target platform.
718721
AvailabilityContext getSwift52Availability();

include/swift/AST/ASTMangler.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class ASTMangler : public Mangler {
7777
public:
7878
enum class SymbolKind {
7979
Default,
80+
AsyncHandlerBody,
8081
DynamicThunk,
8182
SwiftAsObjCThunk,
8283
ObjCAsSwiftThunk,
@@ -323,16 +324,24 @@ class ASTMangler : public Mangler {
323324

324325
void appendAnyGenericType(const GenericTypeDecl *decl);
325326

326-
void appendFunction(AnyFunctionType *fn, bool isFunctionMangling = false,
327-
const ValueDecl *forDecl = nullptr);
327+
enum FunctionManglingKind {
328+
NoFunctionMangling,
329+
FunctionMangling,
330+
AsyncHandlerBodyMangling
331+
};
332+
333+
void appendFunction(AnyFunctionType *fn,
334+
FunctionManglingKind functionMangling = NoFunctionMangling,
335+
const ValueDecl *forDecl = nullptr);
328336
void appendFunctionType(AnyFunctionType *fn, bool isAutoClosure = false,
329337
const ValueDecl *forDecl = nullptr);
330338
void appendClangType(AnyFunctionType *fn);
331339
template <typename FnType>
332340
void appendClangType(FnType *fn, llvm::raw_svector_ostream &os);
333341

334342
void appendFunctionSignature(AnyFunctionType *fn,
335-
const ValueDecl *forDecl = nullptr);
343+
const ValueDecl *forDecl,
344+
FunctionManglingKind functionMangling);
336345

337346
void appendFunctionInputType(ArrayRef<AnyFunctionType::Param> params,
338347
const ValueDecl *forDecl = nullptr);
@@ -383,7 +392,10 @@ class ASTMangler : public Mangler {
383392
GenericSignature &genericSig,
384393
GenericSignature &parentGenericSig);
385394

386-
void appendDeclType(const ValueDecl *decl, bool isFunctionMangling = false);
395+
396+
397+
void appendDeclType(const ValueDecl *decl,
398+
FunctionManglingKind functionMangling = NoFunctionMangling);
387399

388400
bool tryAppendStandardSubstitution(const GenericTypeDecl *type);
389401

@@ -400,7 +412,7 @@ class ASTMangler : public Mangler {
400412

401413
void appendEntity(const ValueDecl *decl, StringRef EntityOp, bool isStatic);
402414

403-
void appendEntity(const ValueDecl *decl);
415+
void appendEntity(const ValueDecl *decl, bool isAsyncHandlerBody = false);
404416

405417
void appendProtocolConformance(const ProtocolConformance *conformance);
406418
void appendProtocolConformanceRef(const RootProtocolConformance *conformance);

include/swift/AST/Builtins.def

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,15 @@ BUILTIN_MISC_OPERATION_WITH_SILGEN(CreateAsyncTaskFuture,
752752
/// is a pure value and therefore we can consider it as readnone).
753753
BUILTIN_MISC_OPERATION_WITH_SILGEN(GlobalStringTablePointer, "globalStringTablePointer", "n", Special)
754754

755+
// autoDiffCreateLinearMapContext: (Builtin.Word) -> Builtin.NativeObject
756+
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffCreateLinearMapContext, "autoDiffCreateLinearMapContext", "n", Special)
757+
758+
// autoDiffProjectTopLevelSubcontext: (Builtin.NativeObject) -> Builtin.RawPointer
759+
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffProjectTopLevelSubcontext, "autoDiffProjectTopLevelSubcontext", "n", Special)
760+
761+
// autoDiffAllocateSubcontext: (Builtin.NativeObject, Builtin.Word) -> Builtin.RawPointer
762+
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffAllocateSubcontext, "autoDiffAllocateSubcontext", "", Special)
763+
755764
#undef BUILTIN_MISC_OPERATION_WITH_SILGEN
756765

757766
#undef BUILTIN_MISC_OPERATION

include/swift/AST/DiagnosticsParse.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,9 @@ ERROR(attr_specialize_missing_comma,none,
15671567
ERROR(attr_specialize_unknown_parameter_name,none,
15681568
"unknown parameter %0 in '_specialize attribute'", (StringRef))
15691569

1570+
ERROR(attr_specialize_unsupported_exported_true ,none,
1571+
"'exported: true' has no effect in '_specialize' attribute", (StringRef))
1572+
15701573
ERROR(attr_specialize_expected_bool_value,none,
15711574
"expected a boolean true or false value in '_specialize' attribute", ())
15721575

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,10 @@ REMARK(cross_import_added,none,
908908
"import of %0 and %1 triggered a cross-import of %2",
909909
(Identifier, Identifier, Identifier))
910910

911+
REMARK(module_loaded,none,
912+
"loaded module at %0",
913+
(StringRef))
914+
911915
// Operator decls
912916
ERROR(ambiguous_operator_decls,none,
913917
"ambiguous operator declarations found for operator", ())

include/swift/AST/ExtInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,10 @@ class SILExtInfo {
828828
return builder.withNoEscape(noEscape).build();
829829
}
830830

831+
SILExtInfo withAsync(bool isAsync = true) const {
832+
return builder.withAsync(isAsync).build();
833+
}
834+
831835
bool isEqualTo(SILExtInfo other, bool useClangTypes) const {
832836
return builder.isEqualTo(other.builder, useClangTypes);
833837
}

include/swift/AST/SemanticAttrs.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,10 @@ SEMANTICS_ATTR(KEYPATH_KVC_KEY_PATH_STRING, "keypath.kvcKeyPathString")
106106
/// consider inlining where to put these.
107107
SEMANTICS_ATTR(FORCE_EMIT_OPT_REMARK_PREFIX, "optremark")
108108

109+
/// An attribute that when attached to a class causes instances of the class to
110+
/// be forbidden from having associated objects set upon them. This is only used
111+
/// for testing purposes.
112+
SEMANTICS_ATTR(OBJC_FORBID_ASSOCIATED_OBJECTS, "objc.forbidAssociatedObjects")
113+
109114
#undef SEMANTICS_ATTR
110115

0 commit comments

Comments
 (0)