Skip to content

Commit 5cbf589

Browse files
committed
Small ease of use convenience APIs. NFC.
1 parent 9bdf9f2 commit 5cbf589

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/SILGen/Initialization.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424

2525
namespace swift {
2626
namespace Lowering {
27-
class SILGenFunction;
2827

28+
class SILGenFunction;
2929
class Initialization;
3030
using InitializationPtr = std::unique_ptr<Initialization>;
31+
class TemporaryInitialization;
32+
using TemporaryInitializationPtr = std::unique_ptr<TemporaryInitialization>;
3133

3234
/// An abstract class for consuming a value. This is used for initializing
3335
/// variables, although that is not the only way it is used.

lib/SILGen/ManagedValue.h

+6
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ class ConsumableManagedValue {
372372
ConsumableManagedValue asBorrowedOperand() const {
373373
return { asUnmanagedValue(), CastConsumptionKind::CopyOnSuccess };
374374
}
375+
376+
/// Return a managed value that's appropriate for copying this value and
377+
/// always consuming it.
378+
ConsumableManagedValue copy(SILGenFunction &SGF, SILLocation loc) const {
379+
return ConsumableManagedValue::forOwned(asUnmanagedValue().copy(SGF, loc));
380+
}
375381
};
376382

377383
} // namespace Lowering

0 commit comments

Comments
 (0)