mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ownership] Change SILUndef to return Any ownership for trivial values and owned for non-trivial values.
This is in preparation for verifying that when ownership verification is enabled that only enums and trivial values can have any ownership. I am doing this in preparation for eliminating ValueOwnershipKind::Trivial. rdar://46294760
This commit is contained in:
@@ -23,8 +23,9 @@ class SILInstruction;
|
||||
class SILModule;
|
||||
|
||||
class SILUndef : public ValueBase {
|
||||
SILUndef(SILType Ty)
|
||||
: ValueBase(ValueKind::SILUndef, Ty, IsRepresentative::Yes) {}
|
||||
ValueOwnershipKind ownershipKind;
|
||||
|
||||
SILUndef(SILType type, SILModule &m);
|
||||
|
||||
public:
|
||||
void operator=(const SILArgument &) = delete;
|
||||
@@ -33,8 +34,12 @@ public:
|
||||
static SILUndef *get(SILType ty, SILModule &m);
|
||||
static SILUndef *get(SILType ty, SILModule *m) { return get(ty, *m); }
|
||||
|
||||
template<class OwnerTy>
|
||||
static SILUndef *getSentinelValue(SILType Ty, OwnerTy Owner) { return new (*Owner) SILUndef(Ty); }
|
||||
template <class OwnerTy>
|
||||
static SILUndef *getSentinelValue(SILType type, SILModule &m, OwnerTy owner) {
|
||||
return new (*owner) SILUndef(type, m);
|
||||
}
|
||||
|
||||
ValueOwnershipKind getOwnershipKind() const { return ownershipKind; }
|
||||
|
||||
static bool classof(const SILArgument *) = delete;
|
||||
static bool classof(const SILInstruction *) = delete;
|
||||
|
||||
Reference in New Issue
Block a user