@@ -167,6 +167,11 @@ enum class SILFunctionTypeRepresentation : uint8_t {
167
167
168
168
// / A closure invocation function that has not been bound to a context.
169
169
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,
170
175
};
171
176
172
177
// / Returns true if the function with this convention doesn't carry a context.
@@ -196,6 +201,7 @@ isThinRepresentation(SILFunctionTypeRepresentation rep) {
196
201
case SILFunctionTypeRepresentation::WitnessMethod:
197
202
case SILFunctionTypeRepresentation::CFunctionPointer:
198
203
case SILFunctionTypeRepresentation::Closure:
204
+ case SILFunctionTypeRepresentation::CXXMethod:
199
205
return true ;
200
206
}
201
207
llvm_unreachable (" Unhandled SILFunctionTypeRepresentation in switch." );
@@ -232,6 +238,7 @@ convertRepresentation(SILFunctionTypeRepresentation rep) {
232
238
return {FunctionTypeRepresentation::Block};
233
239
case SILFunctionTypeRepresentation::Thin:
234
240
return {FunctionTypeRepresentation::Thin};
241
+ case SILFunctionTypeRepresentation::CXXMethod:
235
242
case SILFunctionTypeRepresentation::CFunctionPointer:
236
243
return {FunctionTypeRepresentation::CFunctionPointer};
237
244
case SILFunctionTypeRepresentation::Method:
@@ -252,6 +259,7 @@ constexpr bool canBeCalledIndirectly(SILFunctionTypeRepresentation rep) {
252
259
case SILFunctionTypeRepresentation::CFunctionPointer:
253
260
case SILFunctionTypeRepresentation::Block:
254
261
case SILFunctionTypeRepresentation::Closure:
262
+ case SILFunctionTypeRepresentation::CXXMethod:
255
263
return false ;
256
264
case SILFunctionTypeRepresentation::ObjCMethod:
257
265
case SILFunctionTypeRepresentation::Method:
@@ -269,6 +277,7 @@ template <typename Repr> constexpr bool shouldStoreClangType(Repr repr) {
269
277
switch (static_cast <SILFunctionTypeRepresentation>(repr)) {
270
278
case SILFunctionTypeRepresentation::CFunctionPointer:
271
279
case SILFunctionTypeRepresentation::Block:
280
+ case SILFunctionTypeRepresentation::CXXMethod:
272
281
return true ;
273
282
case SILFunctionTypeRepresentation::ObjCMethod:
274
283
case SILFunctionTypeRepresentation::Thick:
@@ -392,6 +401,7 @@ class ASTExtInfoBuilder {
392
401
case SILFunctionTypeRepresentation::ObjCMethod:
393
402
case SILFunctionTypeRepresentation::Method:
394
403
case SILFunctionTypeRepresentation::WitnessMethod:
404
+ case SILFunctionTypeRepresentation::CXXMethod:
395
405
return true ;
396
406
}
397
407
llvm_unreachable (" Unhandled SILFunctionTypeRepresentation in switch." );
@@ -618,6 +628,7 @@ SILFunctionLanguage getSILFunctionLanguage(SILFunctionTypeRepresentation rep) {
618
628
case SILFunctionTypeRepresentation::ObjCMethod:
619
629
case SILFunctionTypeRepresentation::CFunctionPointer:
620
630
case SILFunctionTypeRepresentation::Block:
631
+ case SILFunctionTypeRepresentation::CXXMethod:
621
632
return SILFunctionLanguage::C;
622
633
case SILFunctionTypeRepresentation::Thick:
623
634
case SILFunctionTypeRepresentation::Thin:
@@ -750,6 +761,7 @@ class SILExtInfoBuilder {
750
761
case Representation::ObjCMethod:
751
762
case Representation::Method:
752
763
case Representation::WitnessMethod:
764
+ case SILFunctionTypeRepresentation::CXXMethod:
753
765
return true ;
754
766
}
755
767
llvm_unreachable (" Unhandled Representation in switch." );
@@ -767,6 +779,7 @@ class SILExtInfoBuilder {
767
779
case Representation::Method:
768
780
case Representation::WitnessMethod:
769
781
case Representation::Closure:
782
+ case SILFunctionTypeRepresentation::CXXMethod:
770
783
return false ;
771
784
}
772
785
llvm_unreachable (" Unhandled Representation in switch." );
0 commit comments