@@ -2926,6 +2926,24 @@ class AnyFunctionType : public TypeBase {
2926
2926
ClangTypeInfo getClangTypeInfo () const ;
2927
2927
ClangTypeInfo getCanonicalClangTypeInfo () const ;
2928
2928
2929
+ // / Returns true if the function type stores a Clang type that cannot
2930
+ // / be derived from its Swift type. Returns false otherwise, including if
2931
+ // / the function type is not @convention(c) or @convention(block).
2932
+ // /
2933
+ // / For example, if you have a function pointer from C getting imported with
2934
+ // / the following type:
2935
+ // /
2936
+ // / @convention(c, cType: "void (*)(size_t (*)(size_t))")
2937
+ // / (@convention(c, cType: "size_t (*)(size_t)") (Int) -> Int)) -> Void
2938
+ // /
2939
+ // / The parameter's function type will have hasNonDerivableClangType() = true,
2940
+ // / but the outer function type will have hasNonDerivableClangType() = false,
2941
+ // / because the parameter and result type are sufficient to correctly derive
2942
+ // / the Clang type for the outer function type. In terms of mangling,
2943
+ // / the parameter type's mangling will incorporate the Clang type but the
2944
+ // / outer function type's mangling doesn't need to duplicate that information.
2945
+ bool hasNonDerivableClangType ();
2946
+
2929
2947
ExtInfo getExtInfo () const {
2930
2948
return ExtInfo (Bits.AnyFunctionType .ExtInfoBits , getClangTypeInfo ());
2931
2949
}
@@ -4307,6 +4325,11 @@ class SILFunctionType final
4307
4325
4308
4326
ClangTypeInfo getClangTypeInfo () const ;
4309
4327
4328
+ // / Returns true if the function type stores a Clang type that cannot
4329
+ // / be derived from its Swift type. Returns false otherwise, including if
4330
+ // / the function type is not @convention(c) or @convention(block).
4331
+ bool hasNonDerivableClangType ();
4332
+
4310
4333
bool hasSameExtInfoAs (const SILFunctionType *otherFn);
4311
4334
4312
4335
// / Given that `this` is a `@differentiable` or `@differentiable(linear)`
0 commit comments