Skip to content

Commit c6874bb

Browse files
authored
Merge pull request swiftlang#20512 from harlanhaskins/storage-wars
2 parents 1113bde + 66a61c5 commit c6874bb

File tree

73 files changed

+154
-154
lines changed

Some content is hidden

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

73 files changed

+154
-154
lines changed

include/swift/AST/Attr.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(override, Override,
245245
OnFunc | OnAccessor | OnVar | OnSubscript | OnConstructor | OnAssociatedType |
246246
DeclModifier |
247247
NotSerialized, 44)
248-
SIMPLE_DECL_ATTR(sil_stored, SILStored,
248+
SIMPLE_DECL_ATTR(_hasStorage, HasStorage,
249249
OnVar |
250-
SILOnly |
250+
UserInaccessible |
251251
NotSerialized, 45)
252252
DECL_ATTR(private, AccessControl,
253253
OnFunc | OnAccessor | OnExtension | OnGenericType | OnVar | OnSubscript |

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,12 +2355,12 @@ static void printParameterFlags(ASTPrinter &printer, PrintOptions options,
23552355

23562356
void PrintAST::visitVarDecl(VarDecl *decl) {
23572357
printDocumentationComment(decl);
2358-
// Print @sil_stored when the attribute is not already
2358+
// Print @_hasStorage when the attribute is not already
23592359
// on, decl has storage and it is on a class.
23602360
if (Options.PrintForSIL && decl->hasStorage() &&
23612361
isStructOrClassContext(decl->getDeclContext()) &&
2362-
!decl->getAttrs().hasAttribute<SILStoredAttr>())
2363-
Printer << "@sil_stored ";
2362+
!decl->getAttrs().hasAttribute<HasStorageAttr>())
2363+
Printer << "@_hasStorage ";
23642364
printAttributes(decl);
23652365
printAccess(decl);
23662366
if (!Options.SkipIntroducerKeywords) {

lib/Parse/ParseDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4672,7 +4672,7 @@ Parser::parseDeclVarGetSet(Pattern *pattern, ParseDeclOptions Flags,
46724672
}
46734673

46744674
// Reject accessors on 'let's after parsing them (for better recovery).
4675-
if (PrimaryVar->isLet() && !Attributes.hasAttribute<SILStoredAttr>()) {
4675+
if (PrimaryVar->isLet() && !Attributes.hasAttribute<HasStorageAttr>()) {
46764676
Diag<> DiagID;
46774677
if (accessors.WillSet || accessors.DidSet)
46784678
DiagID = diag::let_cannot_be_observing_property;
@@ -4935,9 +4935,9 @@ Parser::ParsedAccessors::classify(Parser &P, AbstractStorageDecl *storage,
49354935
readWriteImpl = ReadWriteImplKind::Immutable;
49364936
}
49374937

4938-
// Allow the sil_stored attribute to override all the accessors we parsed
4938+
// Allow the _hasStorage attribute to override all the accessors we parsed
49394939
// when making the final classification.
4940-
if (attrs.hasAttribute<SILStoredAttr>()) {
4940+
if (attrs.hasAttribute<HasStorageAttr>()) {
49414941
return StorageImplInfo::getSimpleStored(StorageIsMutable_t(Set != nullptr));
49424942
}
49434943

lib/Sema/TypeCheckAttr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> {
285285
void visitAccessControlAttr(AccessControlAttr *attr);
286286
void visitSetterAccessAttr(SetterAccessAttr *attr);
287287
bool visitAbstractAccessControlAttr(AbstractAccessControlAttr *attr);
288-
void visitSILStoredAttr(SILStoredAttr *attr);
288+
void visitHasStorageAttr(HasStorageAttr *attr);
289289
void visitObjCMembersAttr(ObjCMembersAttr *attr);
290290
};
291291
} // end anonymous namespace
@@ -428,7 +428,7 @@ void AttributeEarlyChecker::visitGKInspectableAttr(GKInspectableAttr *attr) {
428428
attr->getAttrName());
429429
}
430430

431-
void AttributeEarlyChecker::visitSILStoredAttr(SILStoredAttr *attr) {
431+
void AttributeEarlyChecker::visitHasStorageAttr(HasStorageAttr *attr) {
432432
auto *VD = cast<VarDecl>(D);
433433
if (VD->getDeclContext()->getSelfClassDecl())
434434
return;
@@ -819,6 +819,7 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
819819
IGNORED_ATTR(Exported)
820820
IGNORED_ATTR(ForbidSerializingReference)
821821
IGNORED_ATTR(GKInspectable)
822+
IGNORED_ATTR(HasStorage)
822823
IGNORED_ATTR(IBDesignable)
823824
IGNORED_ATTR(IBInspectable)
824825
IGNORED_ATTR(IBOutlet) // checked early.
@@ -846,7 +847,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
846847
IGNORED_ATTR(Semantics)
847848
IGNORED_ATTR(ShowInInterface)
848849
IGNORED_ATTR(SILGenName)
849-
IGNORED_ATTR(SILStored)
850850
IGNORED_ATTR(StaticInitializeObjCMetadata)
851851
IGNORED_ATTR(SynthesizedProtocol)
852852
IGNORED_ATTR(Testable)

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ namespace {
12241224
UNINTERESTING_ATTR(SynthesizedProtocol)
12251225
UNINTERESTING_ATTR(RequiresStoredPropertyInits)
12261226
UNINTERESTING_ATTR(Transparent)
1227-
UNINTERESTING_ATTR(SILStored)
1227+
UNINTERESTING_ATTR(HasStorage)
12281228
UNINTERESTING_ATTR(Testable)
12291229

12301230
UNINTERESTING_ATTR(WarnUnqualifiedAccess)

test/IRGen/access_markers.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import Builtin
44
import Swift
55

66
class A {
7-
@sil_stored var property: Int { get set }
8-
@sil_stored var exProperty: Any { get set }
7+
@_hasStorage var property: Int { get set }
8+
@_hasStorage var exProperty: Any { get set }
99
deinit
1010
init()
1111
}

test/IRGen/class_stack_alloc.sil

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ import Builtin
44
import Swift
55

66
class TestClass {
7-
@sil_stored var a : Int64
7+
@_hasStorage var a : Int64
88
init()
99
}
1010

1111
struct TestStruct {
12-
@sil_stored var a : Int64
13-
@sil_stored var b : Int64
14-
@sil_stored var c : Int64
12+
@_hasStorage var a : Int64
13+
@_hasStorage var b : Int64
14+
@_hasStorage var c : Int64
1515
}
1616

1717
class BigClass {
18-
@sil_stored var a : Int64
19-
@sil_stored var b : Int64
20-
@sil_stored var c : Int64
21-
@sil_stored var d : Int64
22-
@sil_stored var e : Int64
23-
@sil_stored var f : Int64
24-
@sil_stored var g : Int64
18+
@_hasStorage var a : Int64
19+
@_hasStorage var b : Int64
20+
@_hasStorage var c : Int64
21+
@_hasStorage var d : Int64
22+
@_hasStorage var e : Int64
23+
@_hasStorage var f : Int64
24+
@_hasStorage var g : Int64
2525
init()
2626
}
2727

test/IRGen/constant_struct_with_padding.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import Builtin
66
import Swift
77

88
struct T {
9-
@sil_stored var a: Builtin.Int1 { get set }
10-
@sil_stored var b: Builtin.Int32 { get set }
9+
@_hasStorage var a: Builtin.Int1 { get set }
10+
@_hasStorage var b: Builtin.Int32 { get set }
1111
}
1212

1313
// CHECK: @global = hidden global %T4main1TV <{ i1 false, [3 x i8] undef, i32 0 }>, align 4

test/IRGen/exactcast.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Swift
99
import SwiftShims
1010

1111
class Node {
12-
@sil_stored var index: Int { get set }
12+
@_hasStorage var index: Int { get set }
1313
init(index: Int)
1414
func check() -> Int
1515
@objc deinit

test/IRGen/exclusivity.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sil_stage canonical
55
import Swift
66

77
class A {
8-
@sil_stored final var x: Int { get set }
8+
@_hasStorage final var x: Int { get set }
99
init(x: Int)
1010
}
1111
sil_vtable A {}

0 commit comments

Comments
 (0)