Skip to content

Commit e9ff5fd

Browse files
committed
Merge branch 'main' of github.com:apple/swift into main
2 parents aaa0dfe + d639ee8 commit e9ff5fd

File tree

99 files changed

+3727
-387
lines changed

Some content is hidden

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

99 files changed

+3727
-387
lines changed

include/swift/ABI/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ class alignas(Alignment_DefaultActor) DefaultActor : public HeapObject {
4141

4242
} // end namespace swift
4343

44-
#endif
44+
#endif

include/swift/AST/ASTSynthesis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,4 @@ Type synthesizeType(SynthesisContext &SC, const OptionalSynthesizer<S> &s) {
353353

354354
} // end namespace swift
355355

356-
#endif
356+
#endif

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ class alignas(1 << DeclAlignInBits) Decl {
871871
}
872872

873873
/// \returns the unparsed comment attached to this declaration.
874-
RawComment getRawComment(bool SerializedOK = false) const;
874+
RawComment getRawComment(bool SerializedOK = true) const;
875875

876876
Optional<StringRef> getGroupName() const;
877877

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ ERROR(error_mode_cannot_emit_interface,none,
123123
"this mode does not support emitting module interface files", ())
124124
ERROR(error_mode_cannot_emit_module_summary,none,
125125
"this mode does not support emitting module summary files", ())
126+
ERROR(error_mode_cannot_emit_symbol_graph,none,
127+
"this mode does not support emitting symbol graph files", ())
126128
ERROR(cannot_emit_ir_skipping_function_bodies,none,
127129
"the -experimental-skip-*-function-bodies* flags do not support "
128130
"emitting IR", ())

include/swift/AST/Effects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ void simple_display(llvm::raw_ostream &out, FunctionRethrowingKind value);
7474

7575
} // end namespace swift
7676

77-
#endif
77+
#endif

include/swift/AST/ForeignAsyncConvention.h

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,35 @@ class ForeignAsyncConvention {
3030
/// The index of the completion handler parameters.
3131
unsigned CompletionHandlerParamIndex;
3232

33-
/// When non-zero, indicates which parameter to the completion handler is
34-
/// the Error? parameter (minus one) that makes this async function also
33+
/// When non-zero, subtracting one indicates which parameter to the completion handler is
34+
/// the Error? parameter that makes this async function also
3535
/// throwing.
3636
unsigned CompletionHandlerErrorParamIndexPlusOneOrZero;
3737

38+
/// When non-zero, indicates that the presence of an error is determined by
39+
/// an integral argument to the completion handler being zero or nonzero.
40+
unsigned CompletionHandlerFlagParamIndexPlusOneWithPolarityOrZero;
41+
3842
public:
3943
Info()
4044
: CompletionHandlerParamIndex(0),
4145
CompletionHandlerErrorParamIndexPlusOneOrZero(0) { }
4246

4347
Info(
4448
unsigned completionHandlerParamIndex,
45-
Optional<unsigned> completionHandlerErrorParamIndex)
49+
Optional<unsigned> completionHandlerErrorParamIndex,
50+
Optional<unsigned> completionHandlerFlagParamIndex,
51+
bool completionHandlerFlagIsErrorOnZero)
4652
: CompletionHandlerParamIndex(completionHandlerParamIndex),
4753
CompletionHandlerErrorParamIndexPlusOneOrZero(
4854
completionHandlerErrorParamIndex
4955
? *completionHandlerErrorParamIndex + 1
50-
: 0) {}
56+
: 0),
57+
CompletionHandlerFlagParamIndexPlusOneWithPolarityOrZero(
58+
completionHandlerFlagParamIndex
59+
? (*completionHandlerFlagParamIndex | ((unsigned)completionHandlerFlagIsErrorOnZero << 31)) + 1
60+
: 0)
61+
{}
5162

5263
/// Retrieve the index of the completion handler argument in the method's
5364
/// parameter list.
@@ -56,15 +67,46 @@ class ForeignAsyncConvention {
5667
}
5768

5869
/// Retrieve the index of the \c Error? parameter in the completion handler's
59-
/// parameter list. When argument passed to this parameter is non-null, the
60-
/// provided error will be thrown by the async function.
70+
/// parameter list.
71+
///
72+
/// Typically, when argument passed to this parameter is non-null, the
73+
/// provided error will be thrown by the async function. If a
74+
/// \c completionHandlerFlagParamIndex is also specified, the
75+
/// value of that flag instead indicates whether an error should be raised.
6176
Optional<unsigned> completionHandlerErrorParamIndex() const {
6277
if (CompletionHandlerErrorParamIndexPlusOneOrZero == 0)
6378
return None;
6479

6580
return CompletionHandlerErrorParamIndexPlusOneOrZero - 1;
6681
}
6782

83+
/// Retrieve the index of the error flag parameter in the completion handler's
84+
/// parameter list, if any.
85+
///
86+
/// If present, the boolean value of this argument will indicate whether the
87+
/// operation completed with an error. The \c completionHandlerFlagIsErrorOnZero
88+
/// value indicates whether this argument being zero indicates an error, or
89+
/// whether being nonzero indicates an error.
90+
Optional<unsigned> completionHandlerFlagParamIndex() const {
91+
if (CompletionHandlerFlagParamIndexPlusOneWithPolarityOrZero == 0)
92+
return None;
93+
94+
return (CompletionHandlerFlagParamIndexPlusOneWithPolarityOrZero - 1)
95+
& 0x7FFFFFFFu;
96+
}
97+
98+
/// Indicates the polarity of the error flag parameter to the completion handler.
99+
///
100+
/// It is only valid to call this if \c completionHandlerFlagParamIndex returns
101+
/// a non-\c None value; if there is no flag parameter to the completion handler, the value
102+
/// of this property is meaningless. Otherwise, if true is returned, then a zero flag value
103+
/// indicates an error, and nonzero indicates success. If false, then a zero flag value
104+
/// indicates success, and nonzero indicates an error.
105+
bool completionHandlerFlagIsErrorOnZero() const {
106+
return (CompletionHandlerFlagParamIndexPlusOneWithPolarityOrZero - 1)
107+
& 0x80000000u;
108+
}
109+
68110
/// Whether the async function is throwing due to the completion handler
69111
/// having an \c Error? parameter.
70112
///
@@ -86,9 +128,13 @@ class ForeignAsyncConvention {
86128

87129
ForeignAsyncConvention(CanType completionHandlerType,
88130
unsigned completionHandlerParamIndex,
89-
Optional<unsigned> completionHandlerErrorParamIndex)
131+
Optional<unsigned> completionHandlerErrorParamIndex,
132+
Optional<unsigned> completionHandlerFlagParamIndex,
133+
bool completionHandlerFlagIsErrorOnZero)
90134
: CompletionHandlerType(completionHandlerType),
91-
TheInfo(completionHandlerParamIndex, completionHandlerErrorParamIndex)
135+
TheInfo(completionHandlerParamIndex, completionHandlerErrorParamIndex,
136+
completionHandlerFlagParamIndex,
137+
completionHandlerFlagIsErrorOnZero)
92138
{ }
93139

94140
/// Retrieve the type of the completion handler parameter.
@@ -101,11 +147,36 @@ class ForeignAsyncConvention {
101147
}
102148

103149
/// Retrieve the index of the \c Error? parameter in the completion handler's
104-
/// parameter list. When argument passed to this parameter is non-null, the
105-
/// provided error will be thrown by the async function.
150+
/// parameter list.
151+
///
152+
/// Typically, when argument passed to this parameter is non-null, the
153+
/// provided error will be thrown by the async function. If a
154+
/// \c completionHandlerFlagParamIndex is also specified, the
155+
/// value of that flag instead indicates whether an error should be raised.
106156
Optional<unsigned> completionHandlerErrorParamIndex() const {
107157
return TheInfo.completionHandlerErrorParamIndex();
108158
}
159+
160+
/// Retrieve the index of the error flag parameter in the completion handler's
161+
/// parameter list, if any.
162+
///
163+
/// If present, the boolean value of this argument will indicate whether the
164+
/// operation completed with an error. The \c completionHandlerFlagIsErrorOnZero
165+
/// value indicates whether this argument being zero indicates an error, or
166+
/// whether being nonzero indicates an error.
167+
Optional<unsigned> completionHandlerFlagParamIndex() const {
168+
return TheInfo.completionHandlerFlagParamIndex();
169+
}
170+
171+
/// Indicates the polarity of the error flag parameter to the completion handler.
172+
///
173+
/// It is only valid to call this if \c completionHandlerFlagParamIndex returns
174+
/// a non-\c None value. If true is returned, then a zero flag value indicates an error,
175+
/// and nonzero indicates success. If false, then a zero flag value indicates success,
176+
/// and nonzero indicates an error.
177+
bool completionHandlerFlagIsErrorOnZero() const {
178+
return TheInfo.completionHandlerFlagIsErrorOnZero();
179+
}
109180

110181
/// Whether the async function is throwing due to the completion handler
111182
/// having an \c Error? parameter.

include/swift/AST/GenericParamList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,4 @@ class alignas(RequirementRepr) TrailingWhereClause final :
393393

394394
} // namespace swift
395395

396-
#endif // SWIFT_GENERIC_PARAM_LIST_H
396+
#endif // SWIFT_GENERIC_PARAM_LIST_H

include/swift/AST/KnownSDKTypes.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ KNOWN_SDK_TYPE_DECL(ObjectiveC, ObjCBool, StructDecl, 0)
3737

3838
// TODO(async): These might move to the stdlib module when concurrency is
3939
// standardized
40-
KNOWN_SDK_TYPE_DECL(Concurrency, UnsafeContinuation, NominalTypeDecl, 1)
41-
KNOWN_SDK_TYPE_DECL(Concurrency, UnsafeThrowingContinuation, NominalTypeDecl, 1)
40+
KNOWN_SDK_TYPE_DECL(Concurrency, UnsafeContinuation, NominalTypeDecl, 2)
4241

4342
#undef KNOWN_SDK_TYPE_DECL

include/swift/AST/RequestCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,4 +432,4 @@ struct DenseMapInfo<swift::evaluator::RequestKey<Request, Info>> {
432432

433433
} // end namespace llvm
434434

435-
#endif // SWIFT_AST_REQUEST_CACHE_H
435+
#endif // SWIFT_AST_REQUEST_CACHE_H

include/swift/AST/TypeDifferenceVisitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,4 @@ class CanTypeDifferenceVisitor : public CanTypePairVisitor<Impl, bool> {
382382

383383
}
384384

385-
#endif
385+
#endif

0 commit comments

Comments
 (0)