Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions include/swift/SIL/Projection.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,15 @@ class Projection {

/// Returns true if this instruction projects from an address type to an
/// address subtype.
static SingleValueInstruction *isAddressProjection(SILValue V) {
switch (V->getKind()) {
static SingleValueInstruction *isAddressProjection(SILValue v) {
switch (v->getKind()) {
default:
return nullptr;
case ValueKind::IndexAddrInst: {
auto I = cast<IndexAddrInst>(V);
unsigned Scalar;
if (getIntegerIndex(I->getIndex(), Scalar))
return I;
auto *i = cast<IndexAddrInst>(v);
unsigned scalar;
if (getIntegerIndex(i->getIndex(), scalar))
return i;
return nullptr;
}
case ValueKind::StructElementAddrInst:
Expand All @@ -394,10 +394,17 @@ class Projection {
case ValueKind::ProjectBoxInst:
case ValueKind::TupleElementAddrInst:
case ValueKind::UncheckedTakeEnumDataAddrInst:
return cast<SingleValueInstruction>(V);
return cast<SingleValueInstruction>(v);
}
}

static SingleValueInstruction *isAddressProjection(SILInstruction *i) {
auto *svi = dyn_cast<SingleValueInstruction>(i);
if (!svi)
return nullptr;
return isAddressProjection(SILValue(svi));
}

/// Returns true if this instruction projects from an object type to an object
/// subtype.
static SingleValueInstruction *isObjectProjection(SILValue V) {
Expand Down
Loading