@@ -416,6 +416,80 @@ AbstractionPattern::getTupleElementType(unsigned index) const {
416
416
llvm_unreachable (" bad kind" );
417
417
}
418
418
419
+ AbstractionPattern AbstractionPattern::withoutMoveOnly () const {
420
+ switch (getKind ()) {
421
+ case Kind::Invalid:
422
+ llvm_unreachable (" querying invalid abstraction pattern!" );
423
+ case Kind::PartialCurriedObjCMethodType:
424
+ case Kind::CurriedObjCMethodType:
425
+ case Kind::PartialCurriedCFunctionAsMethodType:
426
+ case Kind::CurriedCFunctionAsMethodType:
427
+ case Kind::CFunctionAsMethodType:
428
+ case Kind::ObjCMethodType:
429
+ case Kind::CXXMethodType:
430
+ case Kind::CurriedCXXMethodType:
431
+ case Kind::PartialCurriedCXXMethodType:
432
+ case Kind::CXXOperatorMethodType:
433
+ case Kind::CurriedCXXOperatorMethodType:
434
+ case Kind::PartialCurriedCXXOperatorMethodType:
435
+ case Kind::OpaqueFunction:
436
+ case Kind::OpaqueDerivativeFunction:
437
+ llvm_unreachable (" function types can not be move only" );
438
+ case Kind::ClangType:
439
+ llvm_unreachable (" clang types can not be move only yet" );
440
+ case Kind::ObjCCompletionHandlerArgumentsType:
441
+ llvm_unreachable (" not handled yet" );
442
+ case Kind::Discard:
443
+ llvm_unreachable (" operation not needed on discarded abstractions yet" );
444
+ case Kind::Opaque:
445
+ case Kind::Tuple:
446
+ case Kind::Type:
447
+ if (auto mvi = dyn_cast<SILMoveOnlyType>(getType ())) {
448
+ return AbstractionPattern (getGenericSignature (), mvi->getInnerType ());
449
+ }
450
+ return *this ;
451
+ }
452
+
453
+ llvm_unreachable (" bad kind" );
454
+ }
455
+
456
+ AbstractionPattern AbstractionPattern::withMoveOnly () const {
457
+ switch (getKind ()) {
458
+ case Kind::Invalid:
459
+ llvm_unreachable (" querying invalid abstraction pattern!" );
460
+ case Kind::PartialCurriedObjCMethodType:
461
+ case Kind::CurriedObjCMethodType:
462
+ case Kind::PartialCurriedCFunctionAsMethodType:
463
+ case Kind::CurriedCFunctionAsMethodType:
464
+ case Kind::CFunctionAsMethodType:
465
+ case Kind::ObjCMethodType:
466
+ case Kind::CXXMethodType:
467
+ case Kind::CurriedCXXMethodType:
468
+ case Kind::PartialCurriedCXXMethodType:
469
+ case Kind::CXXOperatorMethodType:
470
+ case Kind::CurriedCXXOperatorMethodType:
471
+ case Kind::PartialCurriedCXXOperatorMethodType:
472
+ case Kind::OpaqueFunction:
473
+ case Kind::OpaqueDerivativeFunction:
474
+ llvm_unreachable (" function types can not be move only" );
475
+ case Kind::ClangType:
476
+ llvm_unreachable (" clang types can not be move only yet" );
477
+ case Kind::ObjCCompletionHandlerArgumentsType:
478
+ llvm_unreachable (" not handled yet" );
479
+ case Kind::Discard:
480
+ llvm_unreachable (" operation not needed on discarded abstractions yet" );
481
+ case Kind::Opaque:
482
+ case Kind::Tuple:
483
+ case Kind::Type:
484
+ if (isa<SILMoveOnlyType>(getType ()))
485
+ return *this ;
486
+ return AbstractionPattern (getGenericSignature (),
487
+ SILMoveOnlyType::get (getType ()));
488
+ }
489
+
490
+ llvm_unreachable (" bad kind" );
491
+ }
492
+
419
493
// / Return a pattern corresponding to the 'self' parameter of the given
420
494
// / Objective-C method.
421
495
AbstractionPattern
0 commit comments