@@ -377,15 +377,15 @@ class Projection {
377
377
378
378
// / Returns true if this instruction projects from an address type to an
379
379
// / address subtype.
380
- static SingleValueInstruction *isAddressProjection (SILValue V ) {
381
- switch (V ->getKind ()) {
380
+ static SingleValueInstruction *isAddressProjection (SILValue v ) {
381
+ switch (v ->getKind ()) {
382
382
default :
383
383
return nullptr ;
384
384
case ValueKind::IndexAddrInst: {
385
- auto I = cast<IndexAddrInst>(V );
386
- unsigned Scalar ;
387
- if (getIntegerIndex (I ->getIndex (), Scalar ))
388
- return I ;
385
+ auto *i = cast<IndexAddrInst>(v );
386
+ unsigned scalar ;
387
+ if (getIntegerIndex (i ->getIndex (), scalar ))
388
+ return i ;
389
389
return nullptr ;
390
390
}
391
391
case ValueKind::StructElementAddrInst:
@@ -394,10 +394,17 @@ class Projection {
394
394
case ValueKind::ProjectBoxInst:
395
395
case ValueKind::TupleElementAddrInst:
396
396
case ValueKind::UncheckedTakeEnumDataAddrInst:
397
- return cast<SingleValueInstruction>(V );
397
+ return cast<SingleValueInstruction>(v );
398
398
}
399
399
}
400
400
401
+ static SingleValueInstruction *isAddressProjection (SILInstruction *i) {
402
+ auto *svi = dyn_cast<SingleValueInstruction>(i);
403
+ if (!svi)
404
+ return nullptr ;
405
+ return isAddressProjection (SILValue (svi));
406
+ }
407
+
401
408
// / Returns true if this instruction projects from an object type to an object
402
409
// / subtype.
403
410
static SingleValueInstruction *isObjectProjection (SILValue V) {
0 commit comments