Skip to content

Commit 4c20aa7

Browse files
committed
---
yaml --- r: 347191 b: refs/heads/master c: 1a6b83f h: refs/heads/master i: 347189: 7ac425e 347187: 3087d9d 347183: cc4a4a8
1 parent 06f0039 commit 4c20aa7

File tree

4 files changed

+44
-6
lines changed

4 files changed

+44
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 27f3f845ed07dabfbc18562301a153270526a7ca
2+
refs/heads/master: 1a6b83feb2bf5583deb22433ea78aa4392ee9585
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,8 @@ bool SILGenModule::hasNonTrivialIVars(ClassDecl *cd) {
956956
auto *vd = dyn_cast<VarDecl>(member);
957957
if (!vd || !vd->hasStorage()) continue;
958958

959-
// FIXME: Expansion
960959
auto &ti = Types.getTypeLowering(vd->getType(),
961-
ResilienceExpansion::Minimal);
960+
ResilienceExpansion::Maximal);
962961
if (!ti.isTrivial())
963962
return true;
964963
}

trunk/lib/SILGen/SILGenExpr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,7 @@ lowerKeyPathSubscriptIndexTypes(
33133313
SmallVectorImpl<IndexTypePair> &indexPatterns,
33143314
SubscriptDecl *subscript,
33153315
SubstitutionMap subscriptSubs,
3316+
ResilienceExpansion expansion,
33163317
bool &needsGenericContext) {
33173318
// Capturing an index value dependent on the generic context means we
33183319
// need the generic context captured in the key path.
@@ -3330,11 +3331,9 @@ lowerKeyPathSubscriptIndexTypes(
33303331
indexTy = indexTy.subst(subscriptSubs);
33313332
}
33323333

3333-
// FIXME: Expansion
33343334
auto indexLoweredTy = SGM.Types.getLoweredType(
33353335
AbstractionPattern::getOpaque(),
3336-
indexTy,
3337-
ResilienceExpansion::Minimal);
3336+
indexTy, expansion);
33383337
indexLoweredTy = indexLoweredTy.mapTypeOutOfContext();
33393338
indexPatterns.push_back({indexTy->mapTypeOutOfContext()
33403339
->getCanonicalType(),
@@ -3531,6 +3530,7 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
35313530
SmallVector<IndexTypePair, 4> indexTypes;
35323531
lowerKeyPathSubscriptIndexTypes(*this, indexTypes,
35333532
decl, subs,
3533+
expansion,
35343534
needsGenericContext);
35353535

35363536
SmallVector<KeyPathPatternComponent::Index, 4> indexPatterns;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_struct.swiftmodule -enable-sil-ownership %S/../Inputs/resilient_struct.swift
4+
// RUN: %target-swift-emit-silgen -I %t -enable-sil-ownership -enable-resilience %s | %FileCheck %s
5+
6+
import resilient_struct
7+
8+
public class Base {}
9+
10+
public struct MyResilientInt {
11+
var i: Int
12+
13+
public init(i: Int) { self.i = i }
14+
}
15+
16+
public class NeedsIVarDetroyer : Base {
17+
var x = ResilientInt(i: 0)
18+
}
19+
20+
public class DoesNotNeedIVarDestroyer : Base {
21+
var x = MyResilientInt(i: 0)
22+
}
23+
24+
// CHECK-LABEL: sil_vtable NeedsIVarDetroyer {
25+
// CHECK-NEXT: #Base.init!allocator.1: (Base.Type) -> () -> Base
26+
// CHECK-NEXT: #NeedsIVarDetroyer.x!getter.1: (NeedsIVarDetroyer) -> () -> resilient_struct.ResilientInt
27+
// CHECK-NEXT: #NeedsIVarDetroyer.x!setter.1: (NeedsIVarDetroyer) -> (resilient_struct.ResilientInt) -> ()
28+
// CHECK-NEXT: #NeedsIVarDetroyer.x!modify.1: (NeedsIVarDetroyer) -> () -> ()
29+
// CHECK-NEXT: #NeedsIVarDetroyer.deinit!deallocator.1
30+
// CHECK-NEXT: #NeedsIVarDetroyer!ivardestroyer.1
31+
// CHECK-NEXT: }
32+
33+
// CHECK-LABEL: sil_vtable DoesNotNeedIVarDestroyer {
34+
// CHECK-NEXT: #Base.init!allocator.1: (Base.Type) -> () -> Base
35+
// CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!getter.1: (DoesNotNeedIVarDestroyer) -> () -> MyResilientInt
36+
// CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!setter.1: (DoesNotNeedIVarDestroyer) -> (MyResilientInt) -> ()
37+
// CHECK-NEXT: #DoesNotNeedIVarDestroyer.x!modify.1: (DoesNotNeedIVarDestroyer) -> () -> ()
38+
// CHECK-NEXT: #DoesNotNeedIVarDestroyer.deinit!deallocator.1
39+
// CHECK-NEXT: }

0 commit comments

Comments
 (0)