@@ -334,50 +334,73 @@ class SILFunctionArgument : public SILArgument {
334
334
// ===----------------------------------------------------------------------===//
335
335
336
336
inline bool SILArgument::isPhiArgument () const {
337
- if (auto *phiArg = dyn_cast<SILPhiArgument>(this ))
338
- return phiArg->isPhiArgument ();
339
-
340
- return false ;
337
+ switch (getKind ()) {
338
+ case SILArgumentKind::SILPhiArgument:
339
+ return cast<SILPhiArgument>(this )->isPhiArgument ();
340
+ case SILArgumentKind::SILFunctionArgument:
341
+ return false ;
342
+ }
343
+ llvm_unreachable (" Covered switch is not covered?!" );
341
344
}
342
345
343
346
inline SILValue
344
347
SILArgument::getIncomingPhiValue (SILBasicBlock *predBlock) const {
345
- if (isa<SILFunctionArgument>(this ))
348
+ switch (getKind ()) {
349
+ case SILArgumentKind::SILPhiArgument:
350
+ return cast<SILPhiArgument>(this )->getIncomingPhiValue (predBlock);
351
+ case SILArgumentKind::SILFunctionArgument:
346
352
return SILValue ();
347
- return cast<SILPhiArgument>(this )->getIncomingPhiValue (predBlock);
353
+ }
354
+ llvm_unreachable (" Covered switch is not covered?!" );
348
355
}
349
356
350
357
inline bool SILArgument::getIncomingPhiValues (
351
358
SmallVectorImpl<SILValue> &returnedPhiValues) const {
352
- if (isa<SILFunctionArgument>(this ))
359
+ switch (getKind ()) {
360
+ case SILArgumentKind::SILPhiArgument:
361
+ return cast<SILPhiArgument>(this )->getIncomingPhiValues (returnedPhiValues);
362
+ case SILArgumentKind::SILFunctionArgument:
353
363
return false ;
354
- return cast<SILPhiArgument>(this )->getIncomingPhiValues (returnedPhiValues);
364
+ }
365
+ llvm_unreachable (" Covered switch is not covered?!" );
355
366
}
356
367
357
368
inline bool SILArgument::getIncomingPhiValues (
358
369
SmallVectorImpl<std::pair<SILBasicBlock *, SILValue>>
359
370
&returnedPredAndPhiValuePairs) const {
360
- if (isa<SILFunctionArgument>(this ))
371
+ switch (getKind ()) {
372
+ case SILArgumentKind::SILPhiArgument:
373
+ return cast<SILPhiArgument>(this )->getIncomingPhiValues (
374
+ returnedPredAndPhiValuePairs);
375
+ case SILArgumentKind::SILFunctionArgument:
361
376
return false ;
362
- return cast<SILPhiArgument>( this )-> getIncomingPhiValues (
363
- returnedPredAndPhiValuePairs );
377
+ }
378
+ llvm_unreachable ( " Covered switch is not covered?! " );
364
379
}
365
380
366
381
inline bool SILArgument::getSingleTerminatorOperands (
367
382
SmallVectorImpl<SILValue> &returnedSingleTermOperands) const {
368
- if (isa<SILFunctionArgument>(this ))
383
+ switch (getKind ()) {
384
+ case SILArgumentKind::SILPhiArgument:
385
+ return cast<SILPhiArgument>(this )->getSingleTerminatorOperands (
386
+ returnedSingleTermOperands);
387
+ case SILArgumentKind::SILFunctionArgument:
369
388
return false ;
370
- return cast<SILPhiArgument>( this )-> getSingleTerminatorOperands (
371
- returnedSingleTermOperands );
389
+ }
390
+ llvm_unreachable ( " Covered switch is not covered?! " );
372
391
}
373
392
374
393
inline bool SILArgument::getSingleTerminatorOperands (
375
394
SmallVectorImpl<std::pair<SILBasicBlock *, SILValue>>
376
395
&returnedSingleTermOperands) const {
377
- if (isa<SILFunctionArgument>(this ))
396
+ switch (getKind ()) {
397
+ case SILArgumentKind::SILPhiArgument:
398
+ return cast<SILPhiArgument>(this )->getSingleTerminatorOperands (
399
+ returnedSingleTermOperands);
400
+ case SILArgumentKind::SILFunctionArgument:
378
401
return false ;
379
- return cast<SILPhiArgument>( this )-> getSingleTerminatorOperands (
380
- returnedSingleTermOperands );
402
+ }
403
+ llvm_unreachable ( " Covered switch is not covered?! " );
381
404
}
382
405
383
406
} // end swift namespace
0 commit comments