mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ownership] Make ForwardingOperand truly a loose wrapper around an operand.
This implies making -> and * return an Operand * instead of an OwnershipForwardingInst. So one can thus do: ForwardingOperand op; op.myForwardingOperandMethod(); op->myOperandMethod();
This commit is contained in:
@@ -82,29 +82,24 @@ class ForwardingOperand {
|
||||
public:
|
||||
static Optional<ForwardingOperand> get(Operand *use);
|
||||
|
||||
Operand *getUse() const { return use; }
|
||||
OwnershipConstraint getOwnershipConstraint() const {
|
||||
// We use a force unwrap since a ForwardingOperand should always have an
|
||||
// ownership constraint.
|
||||
return use->getOwnershipConstraint();
|
||||
}
|
||||
|
||||
ValueOwnershipKind getOwnershipKind() const;
|
||||
void setOwnershipKind(ValueOwnershipKind newKind) const;
|
||||
void replaceOwnershipKind(ValueOwnershipKind oldKind,
|
||||
ValueOwnershipKind newKind) const;
|
||||
|
||||
const OwnershipForwardingInst *operator->() const {
|
||||
return cast<OwnershipForwardingInst>(use->getUser());
|
||||
}
|
||||
OwnershipForwardingInst *operator->() {
|
||||
return cast<OwnershipForwardingInst>(use->getUser());
|
||||
}
|
||||
const OwnershipForwardingInst &operator*() const {
|
||||
return *cast<OwnershipForwardingInst>(use->getUser());
|
||||
}
|
||||
OwnershipForwardingInst &operator*() {
|
||||
return *cast<OwnershipForwardingInst>(use->getUser());
|
||||
}
|
||||
const Operand *operator->() const { return use; }
|
||||
|
||||
Operand *operator->() { return use; }
|
||||
|
||||
const Operand &operator*() const { return *use; }
|
||||
|
||||
Operand &operator*() { return *use; }
|
||||
|
||||
/// Call \p visitor with each value that contains the final forwarded
|
||||
/// ownership of. E.x.: result of a unchecked_ref_cast, phi arguments of a
|
||||
|
||||
Reference in New Issue
Block a user