Skip to content

Commit 070f004

Browse files
authored
Merge pull request #61115 from gottesmm/pr-de2fdb0e80ff1b131cdb7ab55bb70873f50c1726
[move-only] Add support for trivial move only lets/args.
2 parents 1eedefe + 31d29be commit 070f004

File tree

2 files changed

+1640
-1
lines changed

2 files changed

+1640
-1
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,8 +2104,9 @@ namespace {
21042104
return handleInfinite(structType, properties);
21052105
}
21062106

2107-
if (handleResilience(structType, D, properties))
2107+
if (handleResilience(structType, D, properties)) {
21082108
return handleAddressOnly(structType, properties);
2109+
}
21092110

21102111
if (D->isCxxNonTrivial()) {
21112112
properties.setAddressOnly();
@@ -2141,6 +2142,13 @@ namespace {
21412142
properties =
21422143
applyLifetimeAnnotation(D->getLifetimeAnnotation(), properties);
21432144

2145+
if (D->isMoveOnly()) {
2146+
properties.setNonTrivial();
2147+
if (properties.isAddressOnly())
2148+
return handleMoveOnlyAddressOnly(structType, properties);
2149+
return handleMoveOnlyReference(structType, properties);
2150+
}
2151+
21442152
return handleAggregateByProperties<LoadableStructTypeLowering>(structType,
21452153
properties);
21462154
}
@@ -2211,6 +2219,13 @@ namespace {
22112219
properties =
22122220
applyLifetimeAnnotation(D->getLifetimeAnnotation(), properties);
22132221

2222+
if (D->isMoveOnly()) {
2223+
properties.setNonTrivial();
2224+
if (properties.isAddressOnly())
2225+
return handleMoveOnlyAddressOnly(enumType, properties);
2226+
return handleMoveOnlyReference(enumType, properties);
2227+
}
2228+
22142229
return handleAggregateByProperties<LoadableEnumTypeLowering>(enumType,
22152230
properties);
22162231
}

0 commit comments

Comments
 (0)