mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -1850,12 +1850,10 @@ class TailAllocatedDebugVariable {
|
||||
int_type HasValue : 1;
|
||||
/// True if this is a let-binding.
|
||||
int_type Constant : 1;
|
||||
/// True if this variable is created by compiler
|
||||
int_type Implicit : 1;
|
||||
/// When this is nonzero there is a tail-allocated string storing
|
||||
/// variable name present. This typically only happens for
|
||||
/// instructions that were created from parsing SIL assembler.
|
||||
int_type NameLength : 13;
|
||||
int_type NameLength : 14;
|
||||
/// The source function argument position from left to right
|
||||
/// starting with 1 or 0 if this is a local variable.
|
||||
int_type ArgNo : 16;
|
||||
@@ -1877,9 +1875,6 @@ public:
|
||||
StringRef getName(const char *buf) const;
|
||||
bool isLet() const { return Bits.Data.Constant; }
|
||||
|
||||
bool isImplicit() const { return Bits.Data.Implicit; }
|
||||
void setImplicit(bool V = true) { Bits.Data.Implicit = V; }
|
||||
|
||||
std::optional<SILDebugVariable>
|
||||
get(VarDecl *VD, const char *buf, std::optional<SILType> AuxVarType = {},
|
||||
std::optional<SILLocation> DeclLoc = {},
|
||||
@@ -1891,8 +1886,8 @@ public:
|
||||
StringRef name = getName(buf);
|
||||
if (VD && name.empty())
|
||||
name = VD->getName().str();
|
||||
return SILDebugVariable(name, isLet(), getArgNo(), isImplicit(), AuxVarType,
|
||||
DeclLoc, DeclScope, DIExprElements);
|
||||
return SILDebugVariable(name, isLet(), getArgNo(), AuxVarType, DeclLoc,
|
||||
DeclScope, DIExprElements);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(TailAllocatedDebugVariable) == 4,
|
||||
@@ -4649,6 +4644,37 @@ public:
|
||||
Operand *getSingleNonEndingUse() const;
|
||||
};
|
||||
|
||||
/// BorrowedFromInst - Establishes borrow relations.
|
||||
class BorrowedFromInst final : public InstructionBaseWithTrailingOperands<
|
||||
SILInstructionKind::BorrowedFromInst, BorrowedFromInst,
|
||||
OwnershipForwardingSingleValueInstruction> {
|
||||
friend SILBuilder;
|
||||
|
||||
/// Because of the storage requirements of BorrowedFromInst, object
|
||||
/// creation goes through 'create()'.
|
||||
BorrowedFromInst(SILDebugLocation DebugLoc, ArrayRef<SILValue> operands);
|
||||
|
||||
/// Construct a BorrowedFromInst.
|
||||
static BorrowedFromInst *create(SILDebugLocation DebugLoc, SILValue borrowedValue,
|
||||
ArrayRef<SILValue> enclosingValues, SILModule &M);
|
||||
|
||||
public:
|
||||
|
||||
SILValue getBorrowedValue() {
|
||||
return getAllOperands()[0].get();
|
||||
}
|
||||
|
||||
/// The elements referenced by this StructInst.
|
||||
ArrayRef<Operand> getEnclosingValueOperands() const {
|
||||
return getAllOperands().drop_front();
|
||||
}
|
||||
|
||||
/// The elements referenced by this StructInst.
|
||||
OperandValueArrayRef getEnclosingValues() const {
|
||||
return OperandValueArrayRef(getEnclosingValueOperands());
|
||||
}
|
||||
};
|
||||
|
||||
inline auto BeginBorrowInst::getEndBorrows() const -> EndBorrowRange {
|
||||
return getUsersOfType<EndBorrowInst>();
|
||||
}
|
||||
@@ -11142,6 +11168,7 @@ OwnershipForwardingSingleValueInstruction::classof(SILInstructionKind kind) {
|
||||
case SILInstructionKind::UnconditionalCheckedCastInst:
|
||||
case SILInstructionKind::FunctionExtractIsolationInst:
|
||||
case SILInstructionKind::DropDeinitInst:
|
||||
case SILInstructionKind::BorrowedFromInst:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user