Skip to content

Commit 6075af2

Browse files
Merge pull request #61048 from nate-chandler/no_eager_move_attr
Renamed _noEagerMove attribute.
2 parents 5372177 + 5642a46 commit 6075af2

File tree

12 files changed

+24
-24
lines changed

12 files changed

+24
-24
lines changed

docs/ReferenceGuides/UnderscoredAttributes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ that releases of the value may be hoisted without respect to deinit barriers.
159159

160160
When applied to a type, indicates that all values which are _statically_
161161
instances of that type are themselves `@_eagerMove` as above, unless overridden
162-
with `@_lexical`.
162+
with `@_noEagerMove`.
163163

164164
Aggregates all of whose fields are `@_eagerMove` or trivial are inferred to be
165165
`@_eagerMove`.
@@ -534,7 +534,7 @@ initializers from its superclass. This implies that all designated initializers
534534
overridden. This attribute is often printed alongside
535535
`@_hasMissingDesignatedInitializers` in this case.
536536

537-
## `@_lexical`
537+
## `@_noEagerMove`
538538

539539
When applied to a value, indicates that the value's lifetime is lexical, that
540540
releases of the value may not be hoisted over deinit barriers.
@@ -544,7 +544,7 @@ This is the default behavior, unless the value's type is annotated
544544
annotation.
545545

546546
When applied to a type, indicates that all values which are instances of that
547-
type are themselves `@_lexical` as above.
547+
type are themselves `@_noEagerMove` as above.
548548

549549
This is the default behavior, unless the type annotated is an aggregate that
550550
consists entirely of `@_eagerMove` or trivial values, in which case the

include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(distributed, DistributedActor,
675675
APIBreakingToAdd | APIBreakingToRemove,
676676
118)
677677

678-
SIMPLE_DECL_ATTR(_lexical, Lexical,
678+
SIMPLE_DECL_ATTR(_noEagerMove, NoEagerMove,
679679
UserInaccessible |
680680
ABIStableToAdd | ABIStableToRemove |
681681
APIStableToAdd | APIStableToRemove |

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
990990
auto &attrs = getAttrs();
991991
if (attrs.hasAttribute<EagerMoveAttr>())
992992
return LifetimeAnnotation::EagerMove;
993-
if (attrs.hasAttribute<LexicalAttr>())
993+
if (attrs.hasAttribute<NoEagerMoveAttr>())
994994
return LifetimeAnnotation::Lexical;
995995
return LifetimeAnnotation::None;
996996
}

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ ERROR(silfunc_and_silarg_have_incompatible_sil_value_ownership,none,
516516
"Function type specifies: '@%0'. SIL argument specifies: '@%1'.",
517517
(StringRef, StringRef))
518518
ERROR(sil_arg_both_lexical_and_eagerMove,none,
519-
"Function argument is annotated both @_eagerMove and @_lexical, "
519+
"Function argument is annotated both @_eagerMove and @_noEagerMove, "
520520
"but these are incompatible alternatives", ())
521521
ERROR(expected_sil_colon,none,
522522
"expected ':' before %0", (StringRef))

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,7 @@ ERROR(inherits_executor_without_async,none,
32513251
ERROR(lifetime_invalid_global_scope,none, "%0 is only valid on methods",
32523252
(DeclAttribute))
32533253
ERROR(eagermove_and_lexical_combined,none,
3254-
"@_eagerMove and @_lexical attributes are alternate styles of lifetimes "
3254+
"@_eagerMove and @_noEagerMove attributes are alternate styles of lifetimes "
32553255
"and can't be combined", ())
32563256

32573257
ERROR(autoclosure_function_type,none,

include/swift/AST/LifetimeAnnotation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace swift {
2929
///
3030
/// 1) None: No annotation has been applied.
3131
/// 2) EagerMove: The @_eagerMove attribute has been applied.
32-
/// 3) Lexical: The @_lexical attribute has been applied.
32+
/// 3) NoEagerMove: The @_noEagerMove attribute has been applied.
3333
struct LifetimeAnnotation {
3434
enum Case : uint8_t {
3535
None,

lib/SILGen/SILGenProlog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ struct ArgumentInitHelper {
279279
// Look for the following annotations on the function argument:
280280
// - @noImplicitCopy
281281
// - @_eagerMove
282-
// - @_lexical
282+
// - @_noEagerMove
283283
auto isNoImplicitCopy = pd->isNoImplicitCopy();
284284
auto lifetime = SGF.F.getLifetime(pd, value->getType());
285285

lib/Sema/TypeCheckAttr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
324324

325325
bool visitLifetimeAttr(DeclAttribute *attr);
326326
void visitEagerMoveAttr(EagerMoveAttr *attr);
327-
void visitLexicalAttr(LexicalAttr *attr);
327+
void visitNoEagerMoveAttr(NoEagerMoveAttr *attr);
328328

329329
void visitCompilerInitializedAttr(CompilerInitializedAttr *attr);
330330

@@ -6519,10 +6519,10 @@ void AttributeChecker::visitEagerMoveAttr(EagerMoveAttr *attr) {
65196519
return;
65206520
}
65216521

6522-
void AttributeChecker::visitLexicalAttr(LexicalAttr *attr) {
6522+
void AttributeChecker::visitNoEagerMoveAttr(NoEagerMoveAttr *attr) {
65236523
if (visitLifetimeAttr(attr))
65246524
return;
6525-
// @_lexical and @_eagerMove are opposites and can't be combined.
6525+
// @_noEagerMove and @_eagerMove are opposites and can't be combined.
65266526
if (D->getAttrs().hasAttribute<EagerMoveAttr>()) {
65276527
diagnoseAndRemoveAttr(attr, diag::eagermove_and_lexical_combined);
65286528
return;

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ namespace {
16201620
UNINTERESTING_ATTR(AlwaysEmitConformanceMetadata)
16211621

16221622
UNINTERESTING_ATTR(EagerMove)
1623-
UNINTERESTING_ATTR(Lexical)
1623+
UNINTERESTING_ATTR(NoEagerMove)
16241624
#undef UNINTERESTING_ATTR
16251625

16261626
void visitAvailableAttr(AvailableAttr *attr) {

test/SILGen/lexical_lifetime.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ extension C {
134134
// CHECK: {{bb[0-9]+}}({{%[^,]+}} : @_lexical @owned $C):
135135
// CHECK-LABEL: } // end sil function 'lexical_method_attr'
136136
@_silgen_name("lexical_method_attr")
137-
@_lexical
137+
@_noEagerMove
138138
__consuming
139139
func lexical_method_attr() {}
140140

test/SILOptimizer/inline_lifetime.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct InferredEagerD2S1 {
3434
var i4: InferredEagerD1S4
3535
}
3636

37-
@_lexical
37+
@_noEagerMove
3838
struct LexicalS {
3939
var i: InferredEagerD2S1
4040
}
@@ -47,11 +47,11 @@ struct InferredLexicalD1S1 {
4747
}
4848

4949
struct InferredLexicalD1S2 {
50-
@_lexical var i: InferredEagerD2S1
50+
@_noEagerMove var i: InferredEagerD2S1
5151
}
5252

5353
struct InferredLexicalD1S3 {
54-
@_lexical var i: InferredEagerD2S1
54+
@_noEagerMove var i: InferredEagerD2S1
5555
var j: InferredEagerD2S1
5656
}
5757

test/attr/lexical.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,35 @@ enum E {}
99
@_eagerMove // expected-error {{'@_eagerMove' attribute cannot be applied to this declaration}}
1010
typealias EagerTuple = (C, C)
1111

12-
func foo(@_lexical @_eagerMove _ e: E) {} // expected-error {{@_eagerMove and @_lexical attributes are alternate styles of lifetimes and can't be combined}}
12+
func foo(@_noEagerMove @_eagerMove _ e: E) {} // expected-error {{@_eagerMove and @_noEagerMove attributes are alternate styles of lifetimes and can't be combined}}
1313

14-
func bar(@_lexical _ s: S) {} // okay
14+
func bar(@_noEagerMove _ s: S) {} // okay
1515

1616
func baz(@_eagerMove _ c: C) {} // okay
1717

1818
@_eagerMove // expected-error {{@_eagerMove is only valid on methods}}
1919
func bazzoo(_ c: C) {}
2020

21-
@_lexical // expected-error {{@_lexical is only valid on methods}}
21+
@_noEagerMove // expected-error {{@_noEagerMove is only valid on methods}}
2222
func bazzoozoo(_ c: C) {}
2323

2424
extension C {
2525
@_eagerMove
2626
func pazzoo() {}
2727

28-
@_lexical
28+
@_noEagerMove
2929
func pazzoozoo() {}
3030
}
3131

3232
struct S2 {
3333
@_eagerMove let c: C // okay
34-
@_lexical let e: E // okay
34+
@_noEagerMove let e: E // okay
3535
}
3636

3737
func foo() {
38-
@_lexical let s1 = S()
38+
@_noEagerMove let s1 = S()
3939
@_eagerMove var s2 = S()
40-
@_lexical @_eagerMove let s3 = S() // expected-error {{@_eagerMove and @_lexical attributes are alternate styles of lifetimes and can't be combined}}
40+
@_noEagerMove @_eagerMove let s3 = S() // expected-error {{@_eagerMove and @_noEagerMove attributes are alternate styles of lifetimes and can't be combined}}
4141
_ = s1
4242
s2 = S()
4343
_ = s2

0 commit comments

Comments
 (0)