Skip to content

Commit fdc5b2b

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents 8ae9b96 + 5857afe commit fdc5b2b

Some content is hidden

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

49 files changed

+476
-157
lines changed

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ add_library(swift_Concurrency
2424
ThreadingError.cpp
2525
TracingSignpost.cpp
2626
"${PROJECT_SOURCE_DIR}/CompatibilityOverride/CompatibilityOverride.cpp"
27-
"${PROJECT_SOURCE_DIR}/linker-support/magic-symbols-for-install-name.c"
27+
"./linker-support/magic-symbols-for-install-name.c"
2828
Actor.swift
2929
AsyncCompactMapSequence.swift
3030
AsyncDropFirstSequence.swift

Runtimes/Supplemental/Distributed/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ target_link_libraries(swiftDistributed PRIVATE
143143
swift_Concurrency
144144
swift_Builtin_float
145145
$<$<PLATFORM_ID:Android>:swiftAndroid>
146-
$<$<PLATFORM_ID:Windows>:swiftWinSDK>
147-
$<$<PLATFORM_ID:Darwin>:swiftDarwin>)
146+
$<$<PLATFORM_ID:Windows>:swiftWinSDK>)
148147

149148
install(TARGETS swiftDistributed
150149
EXPORT SwiftDistributedTargets

Runtimes/Supplemental/Observation/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ target_link_libraries(swiftObservation PRIVATE
106106
swiftCore
107107
swift_Concurrency
108108
$<$<PLATFORM_ID:Android>:swiftAndroid>
109-
$<$<PLATFORM_ID:Darwin>:swiftDarwin>
110109
$<$<PLATFORM_ID:Linux>:swiftGlibc>
111110
$<$<PLATFORM_ID:Windows>:swiftWinSDK>)
112111

include/swift/AST/AvailabilityDomain.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
namespace swift {
3434
class ASTContext;
3535
class CustomAvailabilityDomain;
36-
class Decl;
3736
class DeclContext;
3837
class FuncDecl;
3938
class ModuleDecl;
39+
class ValueDecl;
4040

4141
/// Represents a dimension of availability (e.g. macOS platform or Swift
4242
/// language mode).
@@ -153,7 +153,7 @@ class AvailabilityDomain final {
153153

154154
/// If `decl` represents an availability domain, returns the corresponding
155155
/// `AvailabilityDomain` value. Otherwise, returns `std::nullopt`.
156-
static std::optional<AvailabilityDomain> forCustom(Decl *decl,
156+
static std::optional<AvailabilityDomain> forCustom(ValueDecl *decl,
157157
const ASTContext &ctx);
158158

159159
static AvailabilityDomain forCustom(const CustomAvailabilityDomain *domain) {
@@ -250,7 +250,7 @@ class AvailabilityDomain final {
250250

251251
/// Returns the decl that represents the domain, or `nullptr` if the domain
252252
/// does not have a decl.
253-
Decl *getDecl() const;
253+
ValueDecl *getDecl() const;
254254

255255
/// Returns the module that the domain belongs to, if it is a custom domain.
256256
ModuleDecl *getModule() const;
@@ -343,22 +343,22 @@ class CustomAvailabilityDomain : public llvm::FoldingSetNode {
343343
Identifier name;
344344
Kind kind;
345345
ModuleDecl *mod;
346-
Decl *decl;
346+
ValueDecl *decl;
347347
FuncDecl *predicateFunc;
348348

349349
CustomAvailabilityDomain(Identifier name, Kind kind, ModuleDecl *mod,
350-
Decl *decl, FuncDecl *predicateFunc);
350+
ValueDecl *decl, FuncDecl *predicateFunc);
351351

352352
public:
353353
static const CustomAvailabilityDomain *get(StringRef name, Kind kind,
354-
ModuleDecl *mod, Decl *decl,
354+
ModuleDecl *mod, ValueDecl *decl,
355355
FuncDecl *predicateFunc,
356356
const ASTContext &ctx);
357357

358358
Identifier getName() const { return name; }
359359
Kind getKind() const { return kind; }
360360
ModuleDecl *getModule() const { return mod; }
361-
Decl *getDecl() const { return decl; }
361+
ValueDecl *getDecl() const { return decl; }
362362

363363
/// Returns the function that should be called at runtime to determine whether
364364
/// the domain is available, or `nullptr` if the domain's availability is not

include/swift/AST/DiagnosticGroups.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ GROUP(TemporaryPointers, "temporary-pointers")
7373
GROUP(TrailingClosureMatching, "trailing-closure-matching")
7474
GROUP(UnknownWarningGroup, "unknown-warning-group")
7575
GROUP(CompilationCaching, "compilation-caching")
76+
GROUP(WeakMutability, "weak-mutability")
7677

7778
#define UNDEFINE_DIAGNOSTIC_GROUPS_MACROS
7879
#include "swift/AST/DefineDiagnosticGroupsMacros.h"

include/swift/AST/DiagnosticsSema.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7414,6 +7414,14 @@ WARNING(variable_tuple_elt_never_mutated, none,
74147414
"variable %0 was never mutated; "
74157415
"consider changing the pattern to 'case (..., let %1, ...)'",
74167416
(Identifier, StringRef))
7417+
GROUPED_WARNING(weak_variable_never_mutated, WeakMutability, none,
7418+
"weak variable %0 was never mutated; "
7419+
"consider %select{removing 'var' to make it|changing to 'let'}1 constant",
7420+
(Identifier, bool))
7421+
GROUPED_WARNING(weak_variable_tuple_elt_never_mutated, WeakMutability, none,
7422+
"weak variable %0 was never mutated; "
7423+
"consider changing the pattern to 'case (..., let %1, ...)'",
7424+
(Identifier, StringRef))
74177425
WARNING(variable_never_read, none,
74187426
"variable %0 was written to, but never read",
74197427
(Identifier))

include/swift/AST/Stmt.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,12 @@ class alignas(1 << PatternAlignInBits) StmtConditionElement {
713713
/// or `let self = self` condition.
714714
/// - If `requiresCaptureListRef` is `true`, additionally requires that the
715715
/// RHS of the self condition references a var defined in a capture list.
716-
bool rebindsSelf(ASTContext &Ctx, bool requiresCaptureListRef = false) const;
716+
/// - If `requireLoadExpr` is `true`, additionally requires that the RHS of
717+
/// the self condition is a `LoadExpr`.
718+
/// TODO: Remove `requireLoadExpr` after full-on of the ImmutableWeakCaptures
719+
/// feature
720+
bool rebindsSelf(ASTContext &Ctx, bool requiresCaptureListRef = false,
721+
bool requireLoadExpr = false) const;
717722

718723
SourceLoc getStartLoc() const;
719724
SourceLoc getEndLoc() const;
@@ -822,7 +827,8 @@ class LabeledConditionalStmt : public LabeledStmt {
822827
/// or `let self = self` condition.
823828
/// - If `requiresCaptureListRef` is `true`, additionally requires that the
824829
/// RHS of the self condition references a var defined in a capture list.
825-
bool rebindsSelf(ASTContext &Ctx, bool requiresCaptureListRef = false) const;
830+
bool rebindsSelf(ASTContext &Ctx, bool requiresCaptureListRef = false,
831+
bool requireLoadExpr = false) const;
826832

827833
static bool classof(const Stmt *S) {
828834
return S->getKind() >= StmtKind::First_LabeledConditionalStmt &&

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ UPCOMING_FEATURE(InternalImportsByDefault, 409, 7)
297297
MIGRATABLE_UPCOMING_FEATURE(MemberImportVisibility, 444, 7)
298298
MIGRATABLE_UPCOMING_FEATURE(InferIsolatedConformances, 470, 7)
299299
MIGRATABLE_UPCOMING_FEATURE(NonisolatedNonsendingByDefault, 461, 7)
300+
UPCOMING_FEATURE(ImmutableWeakCaptures, 481, 7)
300301

301302
// Optional language features / modes
302303

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5908,7 +5908,7 @@ const AvailabilityContext::Storage *AvailabilityContext::Storage::get(
59085908

59095909
const CustomAvailabilityDomain *
59105910
CustomAvailabilityDomain::get(StringRef name, Kind kind, ModuleDecl *mod,
5911-
Decl *decl, FuncDecl *predicateFunc,
5911+
ValueDecl *decl, FuncDecl *predicateFunc,
59125912
const ASTContext &ctx) {
59135913
auto identifier = ctx.getIdentifier(name);
59145914
llvm::FoldingSetNodeID id;

lib/AST/AvailabilityDomain.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ getCustomDomainKind(clang::FeatureAvailKind featureAvailKind) {
3939
}
4040

4141
static const CustomAvailabilityDomain *
42-
customDomainForClangDecl(Decl *decl, const ASTContext &ctx) {
42+
customDomainForClangDecl(ValueDecl *decl, const ASTContext &ctx) {
4343
auto *clangDecl = decl->getClangDecl();
4444
ASSERT(clangDecl);
4545

@@ -68,7 +68,7 @@ customDomainForClangDecl(Decl *decl, const ASTContext &ctx) {
6868
}
6969

7070
std::optional<AvailabilityDomain>
71-
AvailabilityDomain::forCustom(Decl *decl, const ASTContext &ctx) {
71+
AvailabilityDomain::forCustom(ValueDecl *decl, const ASTContext &ctx) {
7272
if (!decl)
7373
return std::nullopt;
7474

@@ -247,7 +247,7 @@ llvm::StringRef AvailabilityDomain::getNameForAttributePrinting() const {
247247
}
248248
}
249249

250-
Decl *AvailabilityDomain::getDecl() const {
250+
ValueDecl *AvailabilityDomain::getDecl() const {
251251
if (auto *customDomain = getCustomDomain())
252252
return customDomain->getDecl();
253253

@@ -369,7 +369,8 @@ bool StableAvailabilityDomainComparator::operator()(
369369
}
370370

371371
CustomAvailabilityDomain::CustomAvailabilityDomain(Identifier name, Kind kind,
372-
ModuleDecl *mod, Decl *decl,
372+
ModuleDecl *mod,
373+
ValueDecl *decl,
373374
FuncDecl *predicateFunc)
374375
: name(name), kind(kind), mod(mod), decl(decl),
375376
predicateFunc(predicateFunc) {

0 commit comments

Comments
 (0)