@@ -167,6 +167,11 @@ enum class SILFunctionTypeRepresentation : uint8_t {
167167
168168 // / A closure invocation function that has not been bound to a context.
169169 Closure,
170+
171+ // / A C++ method that takes a "this" argument (not a static C++ method or
172+ // / constructor). Except for
173+ // / handling the "this" argument, has the same behavior as "CFunctionPointer".
174+ CXXMethod,
170175};
171176
172177// / Returns true if the function with this convention doesn't carry a context.
@@ -196,6 +201,7 @@ isThinRepresentation(SILFunctionTypeRepresentation rep) {
196201 case SILFunctionTypeRepresentation::WitnessMethod:
197202 case SILFunctionTypeRepresentation::CFunctionPointer:
198203 case SILFunctionTypeRepresentation::Closure:
204+ case SILFunctionTypeRepresentation::CXXMethod:
199205 return true ;
200206 }
201207 llvm_unreachable (" Unhandled SILFunctionTypeRepresentation in switch." );
@@ -232,6 +238,7 @@ convertRepresentation(SILFunctionTypeRepresentation rep) {
232238 return {FunctionTypeRepresentation::Block};
233239 case SILFunctionTypeRepresentation::Thin:
234240 return {FunctionTypeRepresentation::Thin};
241+ case SILFunctionTypeRepresentation::CXXMethod:
235242 case SILFunctionTypeRepresentation::CFunctionPointer:
236243 return {FunctionTypeRepresentation::CFunctionPointer};
237244 case SILFunctionTypeRepresentation::Method:
@@ -252,6 +259,7 @@ constexpr bool canBeCalledIndirectly(SILFunctionTypeRepresentation rep) {
252259 case SILFunctionTypeRepresentation::CFunctionPointer:
253260 case SILFunctionTypeRepresentation::Block:
254261 case SILFunctionTypeRepresentation::Closure:
262+ case SILFunctionTypeRepresentation::CXXMethod:
255263 return false ;
256264 case SILFunctionTypeRepresentation::ObjCMethod:
257265 case SILFunctionTypeRepresentation::Method:
@@ -269,6 +277,7 @@ template <typename Repr> constexpr bool shouldStoreClangType(Repr repr) {
269277 switch (static_cast <SILFunctionTypeRepresentation>(repr)) {
270278 case SILFunctionTypeRepresentation::CFunctionPointer:
271279 case SILFunctionTypeRepresentation::Block:
280+ case SILFunctionTypeRepresentation::CXXMethod:
272281 return true ;
273282 case SILFunctionTypeRepresentation::ObjCMethod:
274283 case SILFunctionTypeRepresentation::Thick:
@@ -392,6 +401,7 @@ class ASTExtInfoBuilder {
392401 case SILFunctionTypeRepresentation::ObjCMethod:
393402 case SILFunctionTypeRepresentation::Method:
394403 case SILFunctionTypeRepresentation::WitnessMethod:
404+ case SILFunctionTypeRepresentation::CXXMethod:
395405 return true ;
396406 }
397407 llvm_unreachable (" Unhandled SILFunctionTypeRepresentation in switch." );
@@ -618,6 +628,7 @@ SILFunctionLanguage getSILFunctionLanguage(SILFunctionTypeRepresentation rep) {
618628 case SILFunctionTypeRepresentation::ObjCMethod:
619629 case SILFunctionTypeRepresentation::CFunctionPointer:
620630 case SILFunctionTypeRepresentation::Block:
631+ case SILFunctionTypeRepresentation::CXXMethod:
621632 return SILFunctionLanguage::C;
622633 case SILFunctionTypeRepresentation::Thick:
623634 case SILFunctionTypeRepresentation::Thin:
@@ -750,6 +761,7 @@ class SILExtInfoBuilder {
750761 case Representation::ObjCMethod:
751762 case Representation::Method:
752763 case Representation::WitnessMethod:
764+ case SILFunctionTypeRepresentation::CXXMethod:
753765 return true ;
754766 }
755767 llvm_unreachable (" Unhandled Representation in switch." );
@@ -767,6 +779,7 @@ class SILExtInfoBuilder {
767779 case Representation::Method:
768780 case Representation::WitnessMethod:
769781 case Representation::Closure:
782+ case SILFunctionTypeRepresentation::CXXMethod:
770783 return false ;
771784 }
772785 llvm_unreachable (" Unhandled Representation in switch." );
0 commit comments