mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Attach an OwnershipComponent to weak/unowned member references.
Partially fixes <rdar://problem/16989616>, but exposes an IRGen crash (which is likely <rdar://problem/16979789>) behind it. Swift SVN r18585
This commit is contained in:
@@ -535,7 +535,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
/// Remap an weak value to Optional<T>*, or unowned pointer to T*.
|
||||
/// Remap a weak value to Optional<T>*, or unowned pointer to T*.
|
||||
class OwnershipComponent : public LogicalPathComponent {
|
||||
public:
|
||||
OwnershipComponent(LValueTypeData typeData)
|
||||
@@ -715,6 +715,12 @@ LValue SILGenLValue::visitMemberRefExpr(MemberRefExpr *e) {
|
||||
} else {
|
||||
lv.add<StructElementComponent>(var, varStorageType, typeData);
|
||||
}
|
||||
|
||||
// If the member has weak or unowned storage, convert it away.
|
||||
if (varStorageType.is<ReferenceStorageType>()) {
|
||||
lv.add<OwnershipComponent>(typeData);
|
||||
}
|
||||
|
||||
return std::move(lv);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user