@@ -179,15 +179,26 @@ class AbstractionPattern {
179
179
// / type. ObjCMethod is valid. OtherData is an encoded foreign
180
180
// / error index.
181
181
ObjCMethodType,
182
- // / The uncurried imported type of a C++ method. OrigType is valid and is a
183
- // / function type. CXXMethod is valid.
182
+ // / The uncurried imported type of a C++ non-operator non-static member
183
+ // / function. OrigType is valid and is a function type. CXXMethod is valid.
184
184
CXXMethodType,
185
- // / The curried imported type of a C++ method. OrigType is valid and is a
186
- // / function type. CXXMethod is valid.
185
+ // / The curried imported type of a C++ non-operator non-static member
186
+ // / function. OrigType is valid and is a function type. CXXMethod is valid.
187
187
CurriedCXXMethodType,
188
- // / The partially-applied curried imported type of a C++ method. OrigType is
189
- // / valid and is a function type. CXXMethod is valid.
188
+ // / The partially-applied curried imported type of a C++ non-operator
189
+ // / non-static member function. OrigType is valid and is a function type.
190
+ // / CXXMethod is valid.
190
191
PartialCurriedCXXMethodType,
192
+ // / The uncurried imported type of a C++ operator non-static member
193
+ // / function. OrigType is valid and is a function type. CXXMethod is valid.
194
+ CXXOperatorMethodType,
195
+ // / The curried imported type of a C++ operator non-static member function.
196
+ // / OrigType is valid and is a function type. CXXMethod is valid.
197
+ CurriedCXXOperatorMethodType,
198
+ // / The partially-applied curried imported type of a C++ operator non-static
199
+ // / member function. OrigType is valid and is a function type. CXXMethod is
200
+ // / valid.
201
+ PartialCurriedCXXOperatorMethodType,
191
202
// / A Swift function whose parameters and results are opaque. This is
192
203
// / like `AP::Type<T>((T) -> T)`, except that the number of parameters is
193
204
// / unspecified.
@@ -341,6 +352,9 @@ class AbstractionPattern {
341
352
case Kind::CXXMethodType:
342
353
case Kind::CurriedCXXMethodType:
343
354
case Kind::PartialCurriedCXXMethodType:
355
+ case Kind::CXXOperatorMethodType:
356
+ case Kind::CurriedCXXOperatorMethodType:
357
+ case Kind::PartialCurriedCXXOperatorMethodType:
344
358
return true ;
345
359
346
360
default :
@@ -465,6 +479,9 @@ class AbstractionPattern {
465
479
case Kind::CXXMethodType:
466
480
case Kind::CurriedCXXMethodType:
467
481
case Kind::PartialCurriedCXXMethodType:
482
+ case Kind::CXXOperatorMethodType:
483
+ case Kind::CurriedCXXOperatorMethodType:
484
+ case Kind::PartialCurriedCXXOperatorMethodType:
468
485
return true ;
469
486
case Kind::Invalid:
470
487
case Kind::Opaque:
@@ -541,6 +558,10 @@ class AbstractionPattern {
541
558
static AbstractionPattern
542
559
getCurriedCXXMethod (CanType origType, const AbstractFunctionDecl *function);
543
560
561
+ static AbstractionPattern
562
+ getCurriedCXXOperatorMethod (CanType origType,
563
+ const AbstractFunctionDecl *function);
564
+
544
565
// / Return an abstraction pattern for the uncurried type of a C++ method.
545
566
// /
546
567
// / For example, if the original function is:
@@ -556,6 +577,15 @@ class AbstractionPattern {
556
577
return pattern;
557
578
}
558
579
580
+ static AbstractionPattern
581
+ getCXXOperatorMethod (CanType origType, const clang::CXXMethodDecl *method) {
582
+ assert (isa<AnyFunctionType>(origType));
583
+ AbstractionPattern pattern;
584
+ pattern.initCXXMethod (nullptr , origType, method,
585
+ Kind::CXXOperatorMethodType);
586
+ return pattern;
587
+ }
588
+
559
589
// / Return an abstraction pattern for the curried type of a C++ method.
560
590
// /
561
591
// / For example, if the original function is:
@@ -572,6 +602,16 @@ class AbstractionPattern {
572
602
return pattern;
573
603
}
574
604
605
+ static AbstractionPattern
606
+ getCurriedCXXOperatorMethod (CanType origType,
607
+ const clang::CXXMethodDecl *method) {
608
+ assert (isa<AnyFunctionType>(origType));
609
+ AbstractionPattern pattern;
610
+ pattern.initCXXMethod (nullptr , origType, method,
611
+ Kind::CurriedCXXOperatorMethodType);
612
+ return pattern;
613
+ }
614
+
575
615
// / For a C-function-as-method pattern,
576
616
// / get the index of the C function parameter that was imported as the
577
617
// / `self` parameter of the imported method, or None if this is a static
@@ -678,6 +718,17 @@ class AbstractionPattern {
678
718
return pattern;
679
719
}
680
720
721
+ static AbstractionPattern
722
+ getPartialCurriedCXXOperatorMethod (CanGenericSignature signature,
723
+ CanType origType,
724
+ const clang::CXXMethodDecl *method) {
725
+ assert (isa<AnyFunctionType>(origType));
726
+ AbstractionPattern pattern;
727
+ pattern.initCXXMethod (signature, origType, method,
728
+ Kind::PartialCurriedCXXOperatorMethodType);
729
+ return pattern;
730
+ }
731
+
681
732
public:
682
733
// / Return an abstraction pattern for the type of an Objective-C method.
683
734
static AbstractionPattern
@@ -813,6 +864,9 @@ class AbstractionPattern {
813
864
case Kind::CXXMethodType:
814
865
case Kind::CurriedCXXMethodType:
815
866
case Kind::PartialCurriedCXXMethodType:
867
+ case Kind::CXXOperatorMethodType:
868
+ case Kind::CurriedCXXOperatorMethodType:
869
+ case Kind::PartialCurriedCXXOperatorMethodType:
816
870
case Kind::Type:
817
871
case Kind::Discard:
818
872
return OrigType;
@@ -849,6 +903,9 @@ class AbstractionPattern {
849
903
case Kind::CXXMethodType:
850
904
case Kind::CurriedCXXMethodType:
851
905
case Kind::PartialCurriedCXXMethodType:
906
+ case Kind::CXXOperatorMethodType:
907
+ case Kind::CurriedCXXOperatorMethodType:
908
+ case Kind::PartialCurriedCXXOperatorMethodType:
852
909
case Kind::Type:
853
910
case Kind::Discard:
854
911
assert (signature || !type->hasTypeParameter ());
@@ -886,6 +943,9 @@ class AbstractionPattern {
886
943
case Kind::CXXMethodType:
887
944
case Kind::CurriedCXXMethodType:
888
945
case Kind::PartialCurriedCXXMethodType:
946
+ case Kind::CXXOperatorMethodType:
947
+ case Kind::CurriedCXXOperatorMethodType:
948
+ case Kind::PartialCurriedCXXOperatorMethodType:
889
949
return true ;
890
950
}
891
951
llvm_unreachable (" bad kind" );
@@ -923,7 +983,9 @@ class AbstractionPattern {
923
983
// / If so, it is legal to call getCXXMethod().
924
984
bool isCXXMethod () const {
925
985
return (getKind () == Kind::CXXMethodType ||
926
- getKind () == Kind::CurriedCXXMethodType);
986
+ getKind () == Kind::CurriedCXXMethodType ||
987
+ getKind () == Kind::CXXOperatorMethodType ||
988
+ getKind () == Kind::CurriedCXXOperatorMethodType);
927
989
}
928
990
929
991
const clang::CXXMethodDecl *getCXXMethod () const {
@@ -958,6 +1020,9 @@ class AbstractionPattern {
958
1020
case Kind::CXXMethodType:
959
1021
case Kind::CurriedCXXMethodType:
960
1022
case Kind::PartialCurriedCXXMethodType:
1023
+ case Kind::CXXOperatorMethodType:
1024
+ case Kind::CurriedCXXOperatorMethodType:
1025
+ case Kind::PartialCurriedCXXOperatorMethodType:
961
1026
case Kind::OpaqueFunction:
962
1027
case Kind::OpaqueDerivativeFunction:
963
1028
return false ;
@@ -994,6 +1059,9 @@ class AbstractionPattern {
994
1059
case Kind::CXXMethodType:
995
1060
case Kind::CurriedCXXMethodType:
996
1061
case Kind::PartialCurriedCXXMethodType:
1062
+ case Kind::CXXOperatorMethodType:
1063
+ case Kind::CurriedCXXOperatorMethodType:
1064
+ case Kind::PartialCurriedCXXOperatorMethodType:
997
1065
case Kind::Type:
998
1066
case Kind::Discard:
999
1067
return dyn_cast<TYPE>(getType ());
@@ -1022,6 +1090,9 @@ class AbstractionPattern {
1022
1090
case Kind::CXXMethodType:
1023
1091
case Kind::CurriedCXXMethodType:
1024
1092
case Kind::PartialCurriedCXXMethodType:
1093
+ case Kind::CXXOperatorMethodType:
1094
+ case Kind::CurriedCXXOperatorMethodType:
1095
+ case Kind::PartialCurriedCXXOperatorMethodType:
1025
1096
case Kind::OpaqueFunction:
1026
1097
case Kind::OpaqueDerivativeFunction:
1027
1098
// We assume that the Clang type might provide additional structure.
@@ -1051,6 +1122,9 @@ class AbstractionPattern {
1051
1122
case Kind::CXXMethodType:
1052
1123
case Kind::CurriedCXXMethodType:
1053
1124
case Kind::PartialCurriedCXXMethodType:
1125
+ case Kind::CXXOperatorMethodType:
1126
+ case Kind::CurriedCXXOperatorMethodType:
1127
+ case Kind::PartialCurriedCXXOperatorMethodType:
1054
1128
case Kind::OpaqueFunction:
1055
1129
case Kind::OpaqueDerivativeFunction:
1056
1130
return false ;
@@ -1078,6 +1152,9 @@ class AbstractionPattern {
1078
1152
case Kind::CXXMethodType:
1079
1153
case Kind::CurriedCXXMethodType:
1080
1154
case Kind::PartialCurriedCXXMethodType:
1155
+ case Kind::CXXOperatorMethodType:
1156
+ case Kind::CurriedCXXOperatorMethodType:
1157
+ case Kind::PartialCurriedCXXOperatorMethodType:
1081
1158
case Kind::OpaqueFunction:
1082
1159
case Kind::OpaqueDerivativeFunction:
1083
1160
llvm_unreachable (" pattern is not a tuple" );
0 commit comments